MCPcopy
hub / github.com/tailscale/tailscale / encode

Function encode

control/controlclient/direct.go:1520–1531  ·  view source on GitHub ↗

encode JSON encodes v as JSON, logging tailcfg.MapRequest values if debugMap is set.

(v any)

Source from the content-addressed store, hash-verified

1518// encode JSON encodes v as JSON, logging tailcfg.MapRequest values if
1519// debugMap is set.
1520func encode(v any) ([]byte, error) {
1521 b, err := json.Marshal(v)
1522 if err != nil {
1523 return nil, err
1524 }
1525 if DevKnob.DumpNetMaps() {
1526 if _, ok := v.(*tailcfg.MapRequest); ok {
1527 log.Printf("MapRequest: %s", b)
1528 }
1529 }
1530 return b, nil
1531}
1532
1533func loadServerPubKeys(ctx context.Context, httpc *http.Client, serverURL string) (*tailcfg.OverTLSPublicKeyResponse, error) {
1534 keyURL := fmt.Sprintf("%v/key?v=%d", serverURL, tailcfg.CurrentCapabilityVersion)

Callers 2

doLoginMethod · 0.85
sendMapRequestMethod · 0.85

Calls 2

PrintfMethod · 0.80
MarshalMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…