package vpnkit
import "github.com/moby/vpnkit/go/pkg/vpnkit"
Package vpnkit allows a running VPNKit service to be reconfigured.
Features
- expose/unexpose TCP and UDP ports
Index ¶
- Constants
- type Client
- type Control
- type DHCPConfiguration
- type Dialer
- type ExposeError
- type Forward
- type GatewayForwards
- type HTTPConfiguration
- type Implementation
- type Port
- type Protocol
- type Server
Constants ¶
const ( // DefaultControlVsock is the AF_VSOCK port the control-plane interface listens on. DefaultControlVsock = 0x1002 // DefaultDataVsock is the AF_VSOCK port the data-plane interface listens on. DefaultDataVsock = 0xf3a4 )
const ( ListPath = "/forwards/list" ExposePortPath = "/forwards/expose/port" ExposePipePath = "/forwards/expose/pipe" UnexposePortPath = "/forwards/unexpose/port" UnexposePipePath = "/forwards/unexpose/pipe" DumpStatePath = "/forwards/dump" )
const ( // TCP port is exposed TCP = Protocol("tcp") // UDP port is exposed UDP = Protocol("udp") // Unix domain socket is exposed Unix = Protocol("unix") )
const DefaultVsockPort = 62373
DefaultVsockPort is the default AF_VSOCK port where vpnkit-forwarder listens.
Types ¶
type Client ¶
type Client interface { Expose(context.Context, *Port) error Unexpose(context.Context, *Port) error ListExposed(context.Context) ([]Port, error) DumpState(context.Context, io.Writer) error }
Client exposes and unexposes ports on vpnkit.
func NewClient ¶
NewClient can be used to manipulated exposed ports.
type Control ¶
type Control interface { Mux() libproxy.Multiplexer // Mux is the current multiplexer to forward to SetMux(libproxy.Multiplexer) // SetMux updates the current multiplexer for future connections }
Control is the port-forwarding control-plane
type DHCPConfiguration ¶
type DHCPConfiguration struct { SearchDomains []string `json:"searchDomains"` DomainName string `json:"domainName"` }
DHCPConfiguration configures the built-in DHCP server.
func (DHCPConfiguration) Write ¶
func (d DHCPConfiguration) Write(w io.Writer) error
type Dialer ¶
type Dialer struct { HyperkitConnectPath string // HyperkitConnectPath is the path of the `connect` Unix domain socket HyperVVMID string // HyperkitVMVMID is the GUID of the VM running vpnkit-forwarder Port int // Port is the AF_VSOCK port where vpnkit-forwarder is listening // contains filtered or unexported fields }
Dialer connects to remote addresses via the vpnkit-forwarder.
func (*Dialer) Dial ¶
Dial connects to the address on the named network.
type ExposeError ¶
type ExposeError struct { Message string `json:"message"` }
ExposeError should be reported through to the user
func (*ExposeError) Error ¶
func (e *ExposeError) Error() string
type Forward ¶
type Forward struct { Protocol Protocol `json:"protocol"` ExternalPort int `json:"external_port"` InternalIP string `json:"internal_ip"` InternalPort int `json:"internal_port"` }
Forward is a single forward from the gateway IP ExternalPort to (InternalIP, InternalPort)
type GatewayForwards ¶
type GatewayForwards []Forward
GatewayForwards is a list of individual forwards.
func (GatewayForwards) Write ¶
func (g GatewayForwards) Write(w io.Writer) error
type HTTPConfiguration ¶
type HTTPConfiguration struct { HTTP string `json:"http,omitempty"` HTTPS string `json:"https,omitempty"` Exclude string `json:"exclude,omitempty"` TransparentHTTPPorts []int `json:"transparent_http_ports"` TransparentHTTPSPorts []int `json:"transparent_https_ports"` }
HTTPConfiguration configures the built-in HTTP proxy.
func (HTTPConfiguration) Write ¶
func (h HTTPConfiguration) Write(w io.Writer) error
type Implementation ¶
type Implementation interface { Client }
Implementation of the control interface.
type Port ¶
type Port struct { Proto Protocol `json:"proto,omitempty"` // Proto is the protocol used by the exposed port. OutIP net.IP `json:"out_ip,omitempty"` // OutIP is the external IP address. OutPort uint16 `json:"out_port,omitempty"` // OutPort is the external port number. OutPath string `json:"out_path,omitempty"` // OutPath is the external Unix domain socket. InIP net.IP `json:"in_ip,omitempty"` // InIP is the internal IP address. InPort uint16 `json:"in_port,omitempty"` // InPort is the internal port number. InPath string `json:"in_path,omitempty"` // InPath is the internal Unix domain socket. Annotation string `json:"annotation,omitempty"` }
Port describes a UDP, TCP port forward or a Unix domain socket forward.
func (*Port) String ¶
String returns a human-readable string
type Protocol ¶
type Protocol string
Protocol used by the exposed port.
type Server ¶
type Server interface { Start() Stop() error List(echo.Context) error ExposePort(echo.Context) error ExposePipe(echo.Context) error UnexposePort(echo.Context) error UnexposePipe(echo.Context) error DumpState(echo.Context) error Echo() *echo.Echo }
Server exposes port control over HTTP.
func NewServer ¶
func NewServer(path string, impl Implementation) (Server, error)
NewServer handles requests to manipulate exposed ports.
Source Files ¶
config.go connection.go control.go defaults.go dialer.go doc.go http.go port.go
Directories ¶
Path | Synopsis |
---|---|
go/pkg/vpnkit/control | |
go/pkg/vpnkit/forward | |
go/pkg/vpnkit/log | |
go/pkg/vpnkit/transport |
- Version
- v0.4.0
- Published
- Mar 4, 2020
- Platform
- js/wasm
- Imports
- 17 packages
- Last checked
- 1 day ago –
Tools for package owners.