package tunnel

import "github.com/moby/vpnkit/go/pkg/tunnel"

Index

Constants

const (
	TCP = Protocol("tcp")
	UDP = Protocol("udp")
)
const EveryPort = 0 // EveryPort should be sent through the tunnel

Functions

func MarshalForwards

func MarshalForwards(all []Forward) ([]byte, error)

MarshalForwards returns a forwards specification in json format.

Types

type Forward

type Forward struct {
	Protocol  Protocol   // Protocol to be forwarded.
	DstPrefix *net.IPNet // Traffic matching this network prefix will be sent via the tunnel.
	DstPort   int        // Traffic with this destination port will be sent via the tunnel.
	Path      string     // Path of the tunnel server.
}

Forward traffic for the given IP destination to the tunnel server on the Unix domain socket path.

func UnmarshalForwards

func UnmarshalForwards(b []byte) ([]Forward, error)

UnmarshalForwards returns a parsed forwards specification.

type Protocol

type Protocol string

type Request

type Request struct {
	Protocol Protocol
	DstIP    net.IP // DstIP is the Destination IP address.
	DstPort  int    // DstPort is the Destination Port.
	SrcIP    net.IP // SrcIP is the Source IP address.
	SrcPort  int    // SrcPort is the Source Port.
}

Request to open a tunnel.

func ReadRequest

func ReadRequest(r io.Reader) (*Request, error)

ReadRequest from vpnkit to open a tunnel to a remote service.

func (*Request) Write

func (r *Request) Write(w io.Writer) error

WriteRequest to vpnkit to open a tunnel to a remote service.

type Response

type Response struct {
	Accepted bool `json:"accepted"` // Accepted is true if the tunnel is now connected.
}

Response to the tunnel open request.

func ReadResponse

func ReadResponse(r io.Reader) (*Response, error)

func (*Response) Write

func (r *Response) Write(w io.Writer) error

Source Files

forwards.go tunnel.go

Version
v0.6.0 (latest)
Published
Apr 8, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
14 hours ago

Tools for package owners.