ExampleServer_Start demonstrates the Start method, which should be called if you need to explicitly start it. Note that the Start method is implicitly called if needed.
()
| 127 | // you need to explicitly start it. Note that the Start method is implicitly |
| 128 | // called if needed. |
| 129 | func ExampleServer_Start() { |
| 130 | srv := new(tsnet.Server) |
| 131 | |
| 132 | if err := srv.Start(); err != nil { |
| 133 | log.Fatal(err) |
| 134 | } |
| 135 | |
| 136 | // Be sure to close the server instance at some point. It will stay open until |
| 137 | // either the OS process ends or the server is explicitly closed. |
| 138 | defer srv.Close() |
| 139 | } |
| 140 | |
| 141 | // ExampleServer_Listen shows you how to create a TCP listener on your tailnet and |
| 142 | // then makes an HTTP server on top of that. |