Movatterモバイル変換


[0]ホーム

URL:


devtunnel

package
v2.24.2Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2025 License:AGPL-3.0Imports:22Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Regions = []Region{{ID:           0,LocationName: "US East Pittsburgh",Nodes: []Node{{ID:            1,RegionID:      0,HostnameHTTPS: "pit-1.try.coder.app",},},},}

Functions

funcNew

func New(ctxcontext.Context, loggerslog.Logger, customTunnelHoststring) (*tunnelsdk.Tunnel,error)

New creates a tunnel with a public URL and returns a listener for incomingconnections on that URL. Connections are made over the wireguard protocol.Tunnel configuration is cached in the user's config directory. Successivecalls to New will always use the same URL. If multiple public URLs inparallel are required, use NewWithConfig.

This useshttps://github.com/coder/wgtunnel as the server and clientimplementation.

funcNewWithConfig

func NewWithConfig(ctxcontext.Context, loggerslog.Logger, cfgConfig) (*tunnelsdk.Tunnel,error)

NewWithConfig calls New with the given config. For documentation, see New.

Types

typeConfig

type Config struct {Versiontunnelsdk.TunnelVersion `json:"version"`PrivateKeydevice.NoisePrivateKey  `json:"private_key"`PublicKeydevice.NoisePublicKey   `json:"public_key"`TunnelNode `json:"tunnel"`// Used in testing.  Normally this is nil, indicating to use DefaultClient.HTTPClient *http.Client `json:"-"`}

funcGenerateConfig

func GenerateConfig(customTunnelHoststring) (Config,error)

typeNode

type Node struct {IDint    `json:"id"`RegionIDint    `json:"region_id"`HostnameHTTPSstring `json:"hostname_https"`AvgLatencytime.Duration `json:"-"`}

funcFindClosestNode

func FindClosestNode(nodes []Node) (Node,error)

FindClosestNode pings each node and returns the one with the lowest latency.

funcNodes

func Nodes(customTunnelHoststring) ([]Node,error)

Nodes returns a list of nodes to use for the tunnel. It will pick a randomnode from each region.

If a customNode is provided, it will be returned as the only node with ID9999.

typeRegion

type Region struct {IDintLocationNamestringNodes        []Node}

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp