MCPcopy Index your code
hub / github.com/coder/coder / NewWithConfig

Function NewWithConfig

coderd/devtunnel/tunnel.go:36–51  ·  view source on GitHub ↗

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

(ctx context.Context, logger slog.Logger, cfg Config)

Source from the content-addressed store, hash-verified

34
35// NewWithConfig calls New with the given config. For documentation, see New.
36func NewWithConfig(ctx context.Context, logger slog.Logger, cfg Config) (*tunnelsdk.Tunnel, error) {
37 u := &url.URL{
38 Scheme: "https",
39 Host: cfg.Tunnel.HostnameHTTPS,
40 }
41
42 c := tunnelsdk.New(u)
43 if cfg.HTTPClient != nil {
44 c.HTTPClient = cfg.HTTPClient
45 }
46 return c.LaunchTunnel(ctx, tunnelsdk.TunnelConfig{
47 Log: logger,
48 Version: cfg.Version,
49 PrivateKey: tunnelsdk.FromNoisePrivateKey(cfg.PrivateKey),
50 })
51}
52
53// New creates a tunnel with a public URL and returns a listener for incoming
54// connections on that URL. Connections are made over the wireguard protocol.

Callers 2

TestTunnelFunction · 0.92
NewFunction · 0.85

Calls 1

NewMethod · 0.65

Tested by 1

TestTunnelFunction · 0.74