Skip to content

Commit 969613c

Browse files
committed
add docs
1 parent fda65ff commit 969613c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

coderd/devtunnel/tunnel.go

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type configExt struct {
4747
PublicKey device.NoisePublicKey `json:"public_key"`
4848
}
4949

50+
// NewWithConfig calls New with the given config. For documentation, see New.
5051
func NewWithConfig(ctx context.Context, logger slog.Logger, cfg Config) (*Tunnel, error) {
5152
err := startUpdateRoutine(ctx, logger, cfg)
5253
if err != nil {
@@ -112,6 +113,11 @@ allowed_ip=%s/128`,
112113
}, nil
113114
}
114115

116+
// New creates a tunnel with a public URL and returns a listener for incoming
117+
// connections on that URL. Connections are made over the wireguard protocol.
118+
// Tunnel configuration is cached in the user's config directory. Successive
119+
// calls to New will always use the same URL. If multiple public URLs in
120+
// parallel are required, use NewWithConfig.
115121
func New(ctx context.Context, logger slog.Logger) (*Tunnel, error) {
116122
cfg, err := readOrGenerateConfig()
117123
if err != nil {

0 commit comments

Comments
 (0)