Movatterモバイル変換


[0]ホーム

URL:


netstack

package
v1.92.2Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:57Imported by:26

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package netstack wires up gVisor's netstack into Tailscale.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeImpl

type Impl struct {// GetTCPHandlerForFlow conditionally handles an incoming TCP flow for the// provided (src/port, dst/port) 4-tuple.//// A nil value is equivalent to a func returning (nil, false).//// If func returns intercept=false, the default forwarding behavior (if// ProcessLocalIPs and/or ProcesssSubnetIPs) takes place.//// When intercept=true, the behavior depends on whether the returned handler// is non-nil: if nil, the connection is rejected. If non-nil, handler takes// over the TCP conn.GetTCPHandlerForFlow func(src, dstnetip.AddrPort) (handler func(net.Conn), interceptbool)// GetUDPHandlerForFlow conditionally handles an incoming UDP flow for the// provided (src/port, dst/port) 4-tuple.//// A nil value is equivalent to a func returning (nil, false).//// If func returns intercept=false, the default forwarding behavior (if// ProcessLocalIPs and/or ProcesssSubnetIPs) takes place.//// When intercept=true, the behavior depends on whether the returned handler// is non-nil: if nil, the connection is rejected. If non-nil, handler takes// over the UDP flow.GetUDPHandlerForFlow func(src, dstnetip.AddrPort) (handler func(nettype.ConnPacketConn), interceptbool)// ProcessLocalIPs is whether netstack should handle incoming// traffic directed at the Node.Addresses (local IPs).// It can only be set before calling Start.ProcessLocalIPsbool// ProcessSubnets is whether netstack should handle incoming// traffic destined to non-local IPs (i.e. whether it should// be a subnet router).// It can only be set before calling Start.ProcessSubnetsbool// contains filtered or unexported fields}

Impl contains the state for the netstack implementation,and implements wgengine.FakeImpl to act as a userspace networkstack when Tailscale is running in fake mode.

funcCreateadded inv1.6.0

func Create(logflogger.Logf, tundev *tstun.Wrapper, ewgengine.Engine, mc *magicsock.Conn, dialer *tsdial.Dialer, dns *dns.Manager, pm *proxymap.Mapper) (*Impl,error)

Create creates and populates a new Impl.

func (*Impl)Closeadded inv1.20.2

func (ns *Impl) Close()error

func (*Impl)DialContextTCPadded inv1.6.0

func (ns *Impl) DialContextTCP(ctxcontext.Context, ippnetip.AddrPort) (*gonet.TCPConn,error)

func (*Impl)DialContextTCPWithBindadded inv1.82.0

func (ns *Impl) DialContextTCPWithBind(ctxcontext.Context, localAddrnetip.Addr, remoteAddrnetip.AddrPort) (*gonet.TCPConn,error)

DialContextTCPWithBind creates a new gonet.TCPConn connected to the specifiedremoteAddress with its local address bound to localAddr on an available port.

func (*Impl)DialContextUDPadded inv1.10.0

func (ns *Impl) DialContextUDP(ctxcontext.Context, ippnetip.AddrPort) (*gonet.UDPConn,error)

func (*Impl)DialContextUDPWithBindadded inv1.82.0

func (ns *Impl) DialContextUDPWithBind(ctxcontext.Context, localAddrnetip.Addr, remoteAddrnetip.AddrPort) (*gonet.UDPConn,error)

DialContextUDPWithBind creates a new gonet.UDPConn. Connected to remoteAddr.With its local address bound to localAddr on an available port.

func (*Impl)ExpVaradded inv1.60.0

func (ns *Impl) ExpVar()expvar.Var

ExpVar returns an expvar variable suitable for registering with expvar.Publish.

func (*Impl)ListenPacketadded inv1.68.0

func (ns *Impl) ListenPacket(network, addressstring) (net.PacketConn,error)

ListenPacket listens for incoming packets for the given network and address.Address must be of the form "ip:port" or "[ip]:port".

As of 2024-05-18, only udp4 and udp6 are supported.

func (*Impl)SetTransportProtocolOptionadded inv1.80.0

func (ns *Impl) SetTransportProtocolOption(transporttcpip.TransportProtocolNumber, optiontcpip.SettableTransportProtocolOption)tcpip.Error

SetTransportProtocolOption forwards to the underlyingstack.Stack.SetTransportProtocolOption. Callers are responsible forensuring that the options are valid, compatible and appropriate for their usecase. Compatibility may change at any version.

func (*Impl)Startadded inv1.6.0

func (ns *Impl) Start(bLocalBackend)error

Start sets up all the handlers so netstack can start working. Implementswgengine.FakeImpl.

func (*Impl)UpdateNetstackIPsadded inv1.50.0

func (ns *Impl) UpdateNetstackIPs(nm *netmap.NetworkMap)

UpdateNetstackIPs updates the set of local IPs that netstack should handlefrom nm.

TODO(bradfitz): don't pass the whole netmap here; just pass the twoaddress slice views.

typeLocalBackendadded inv1.90.0

type LocalBackend =any

LocalBackend is a fake name for *ipnlocal.LocalBackend to avoid an import cycle.

Source Files

View all Source files

Directories

PathSynopsis
Package gro implements GRO for the receive (write) path into gVisor.
Package gro implements GRO for the receive (write) path into gVisor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp