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

Function New

coderd/devtunnel/tunnel.go:61–68  ·  view source on GitHub ↗

New creates a tunnel with a public URL and returns a listener for incoming connections on that URL. Connections are made over the wireguard protocol. Tunnel configuration is cached in the user's config directory. Successive calls to New will always use the same URL. If multiple public URLs in parall

(ctx context.Context, logger slog.Logger, customTunnelHost string)

Source from the content-addressed store, hash-verified

59// This uses https://github.com/coder/wgtunnel as the server and client
60// implementation.
61func New(ctx context.Context, logger slog.Logger, customTunnelHost string) (*tunnelsdk.Tunnel, error) {
62 cfg, err := readOrGenerateConfig(customTunnelHost)
63 if err != nil {
64 return nil, xerrors.Errorf("read or generate config: %w", err)
65 }
66
67 return NewWithConfig(ctx, logger, cfg)
68}
69
70func cfgPath() (string, error) {
71 cfgDir, err := os.UserConfigDir()

Callers 1

ServerMethod · 0.92

Calls 3

readOrGenerateConfigFunction · 0.85
NewWithConfigFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected