MCPcopy
hub / github.com/tailscale/tailscale / ExampleServer_HTTPClient

Function ExampleServer_HTTPClient

tsnet/example_tsnet_test.go:114–124  ·  view source on GitHub ↗

ExampleServer_HTTPClient shows you how to make HTTP requests over your tailnet. If you want to make outgoing HTTP connections to resources on your tailnet, use the HTTP client that the tsnet.Server exposes.

()

Source from the content-addressed store, hash-verified

112// If you want to make outgoing HTTP connections to resources on your tailnet, use
113// the HTTP client that the tsnet.Server exposes.
114func ExampleServer_HTTPClient() {
115 srv := &tsnet.Server{}
116 cli := srv.HTTPClient()
117
118 resp, err := cli.Get("https://hello.ts.net")
119 if resp == nil {
120 log.Fatal(err)
121 }
122 // do something with resp
123 _ = resp
124}
125
126// ExampleServer_Start demonstrates the Start method, which should be called if
127// you need to explicitly start it. Note that the Start method is implicitly

Callers

nothing calls this directly

Calls 3

HTTPClientMethod · 0.95
GetMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…