Documentation ¶
Index ¶
- Variables
- func DefTcp6Server(nt *NetstackTun, handler Gateway) (tcpip.Endpoint, waiter.Queue, error)
- func DefTcpServer(nt *NetstackTun, handler Gateway) (tcpip.Endpoint, waiter.Queue, error)
- func NewReaderWriterLink(tunw io.WriteCloser, tunr io.Reader, opts *Options) tcpip.LinkEndpointID
- func OpenTun(ifn string) (io.ReadWriteCloser, error)
- type Gateway
- type NetstackTun
- type Options
- type UDPGateway
- type UdpLocalReader
Constants ¶
This section is empty.
Variables ¶
var BufConfig = []int{128, 256, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768}
BufConfig defines the shape of the vectorised view used to read packets from the NIC.
var (
Dump = false
)
Functions ¶
func DefTcp6Server ¶
func DefTcpServer ¶
func NewReaderWriterLink ¶
func NewReaderWriterLink(tunw io.WriteCloser, tunr io.Reader, opts *Options) tcpip.LinkEndpointID
New creates a new fd-based endpoint.
Makes fd non-blocking, but does not take ownership of fd, which must remain open for the lifetime of the returned endpoint.
Types ¶
type Gateway ¶
type Gateway interface { DialProxy(ctx context.Context, addr net.Addr, directClientAddr *net.TCPAddr, ctype string, meta ...string) (net.Conn, func(client net.Conn) error, error) }
Interface implemented by Gateway.
type NetstackTun ¶
type NetstackTun struct { // The IP stack serving the tun. It intercepts all TCP connections. IPStack *stack.Stack DefUDP tcpip.Endpoint DefTCP tcpip.Endpoint Handler Gateway UDPHandler UDPGateway // contains filtered or unexported fields }
Intercept using a TUN and google netstack to parse TCP/UDP into streams. The connections are redirected to a capture.ProxyHandler
func NewTunCapture ¶
func NewTunCapture(ep *tcpip.LinkEndpointID, handler Gateway, udpNat UDPGateway, snif bool) *NetstackTun
NewTunCapture creates an in-process tcp stack, backed by an tun-like network interface. All TCP streams initiated on the tun or localhost will be captured.
type Options ¶
type Options struct { MTU uint32 EthernetHeader bool ChecksumOffload bool ClosedFunc func(*tcpip.Error) Address tcpip.LinkAddress }
Options specify the details about the fd-based endpoint to be created.
type UDPGateway ¶
type UDPGateway interface {
HandleUdp(dstAddr net.IP, dstPort uint16, localAddr net.IP, localPort uint16, data []byte)
}
Interface implemented by Gateway.
type UdpLocalReader ¶
type UdpLocalReader interface {
ReadLocal(addr *tcpip.DoubleAddress) (buffer.View, tcpip.ControlMessages, *tcpip.Error)
}