MCPcopy
hub / github.com/tailscale/tailscale / ExampleServer_dir

Function ExampleServer_dir

tsnet/example_tsnet_test.go:51–64  ·  view source on GitHub ↗

ExampleServer_dir shows you how to configure the persistent directory for a tsnet application. This is where the Tailscale node information is stored so that your application can reconnect to your tailnet when the application is restarted. By default, tsnet will store data in your user configuratio

()

Source from the content-addressed store, hash-verified

49// on the name of the binary. Note that this folder must already exist or tsnet
50// calls will fail.
51func ExampleServer_dir() {
52 dir := filepath.Join("/data", "tsnet")
53
54 if err := os.MkdirAll(dir, 0700); err != nil {
55 log.Fatal(err)
56 }
57
58 srv := &tsnet.Server{
59 Dir: dir,
60 }
61
62 // do something with srv
63 _ = srv
64}
65
66// ExampleServer_multipleInstances shows you how to configure multiple instances
67// of tsnet per program. This allows you to have multiple Tailscale nodes in the

Callers

nothing calls this directly

Calls 1

FatalMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…