MCPcopy Create free account
hub / github.com/tailscale/tailcat / tcpipStackOf

Function tcpipStackOf

tailcat.go:584–590  ·  view source on GitHub ↗

tcpipStackOf returns ns's unexported gVisor *stack.Stack. TODO(bradfitz): add an exported accessor to wgengine/netstack.Impl upstream and delete this reflect+unsafe cheat.

(ns *netstack.Impl)

Source from the content-addressed store, hash-verified

582// TODO(bradfitz): add an exported accessor to wgengine/netstack.Impl
583// upstream and delete this reflect+unsafe cheat.
584func tcpipStackOf(ns *netstack.Impl) *stack.Stack {
585 v := reflect.ValueOf(ns).Elem().FieldByName("ipstack")
586 if !v.IsValid() {
587 panic("netstack.Impl has no ipstack field; tailscale.com dep changed?")
588 }
589 return reflect.NewAt(v.Type(), unsafe.Pointer(v.UnsafeAddr())).Elem().Interface().(*stack.Stack)
590}
591
592// AddAllowedClient adds k as an allowed client.
593//

Callers 1

DrainTCPMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected