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
()
| 49 | // on the name of the binary. Note that this folder must already exist or tsnet |
| 50 | // calls will fail. |
| 51 | func 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…