Documentation ¶
Index ¶
- Constants
- func DefaultLinkName(meshname string, ip net.IP) kubelink.LinkName
- func NewBridgeMode(env runmode.RunModeEnv) (runmode.RunMode, error)
- func NewConnectTask(name kubelink.LinkName, runmode *mode) tasks.Task
- func NewTunnelConnection(mux *Mux, conn net.Conn, link *kubelink.Link, links kubelink.Links, ...) (*TunnelConnection, *ConnectionHello, error)
- func RegisterExtension(id byte, c ConnectionHelloExtensionHandler)
- type APIExtension
- type APIExtensionHandler
- type CertInfo
- type ConnectionFailHandler
- type ConnectionHandler
- type ConnectionHello
- type ConnectionHelloExtension
- type ConnectionHelloExtensionHandler
- type ConnectionHelloHeader
- func (this *ConnectionHelloHeader) GetCIDR() *net.IPNet
- func (this *ConnectionHelloHeader) GetClusterAddress() *net.IPNet
- func (this *ConnectionHelloHeader) GetClusterIP() net.IP
- func (this *ConnectionHelloHeader) GetExtensionLength() uint16
- func (this *ConnectionHelloHeader) GetPort() uint16
- func (this *ConnectionHelloHeader) SetCIDR(cidr *net.IPNet)
- func (this *ConnectionHelloHeader) SetClusterAddress(cidr *net.IPNet)
- func (this *ConnectionHelloHeader) SetExtensionLength(len uint16)
- func (this *ConnectionHelloHeader) SetPort(port uint16)
- type DNSExtension
- type DNSExtensionHandler
- type DefaultConnectionHandler
- type LinkStateHandler
- type Mux
- func (this *Mux) AddTunnel(t *TunnelConnection)
- func (this *Mux) AssureTunnel(logger logger.LogContext, link *kubelink.Link) (*TunnelConnection, error)
- func (this *Mux) Close(ip net.IP) error
- func (this *Mux) FindConnection(log logger.LogContext, packet []byte) *TunnelConnection
- func (this *Mux) GetConnectionForIP(ip net.IP) (*TunnelConnection, error)
- func (this *Mux) GetError(ip net.IP) error
- func (this *Mux) HandleTun() error
- func (this *Mux) Notify(t *TunnelConnection, err error)
- func (this *Mux) QueryConnectionForIP(ip net.IP) (*TunnelConnection, *kubelink.Link)
- func (this *Mux) RegisterFailHandler(handlers ...LinkStateHandler)
- func (this *Mux) RemoveTunnel(t *TunnelConnection)
- func (this *Mux) Send(log logger.LogContext, packet []byte) error
- func (this *Mux) ServeConnection(ctx context.Context, conn net.Conn)
- func (this *Mux) SetAutoConnect(b bool)
- type Server
- type Tun
- type TunnelConnection
- func (this *TunnelConnection) ApplyLink(link kubelink.LinkName)
- func (this *TunnelConnection) Close() error
- func (this *TunnelConnection) ReadPacket(data []byte) (int, byte, error)
- func (this *TunnelConnection) RegisterStateHandler(handlers ...ConnectionFailHandler)
- func (this *TunnelConnection) Send(packet []byte) error
- func (this *TunnelConnection) Serve() error
- func (this *TunnelConnection) String() string
- func (this *TunnelConnection) WritePacket(ty byte, data []byte) error
Constants ¶
View Source
const BufferSize = 17000
View Source
const DefaultPort = 80
View Source
const EXT_APIACCESS = 1
View Source
const EXT_DNS = 2
View Source
const PACKET_TYPE_DATA = 0
View Source
const PACKET_TYPE_HELLO = 1
Variables ¶
This section is empty.
Functions ¶
func NewBridgeMode ¶
func NewBridgeMode(env runmode.RunModeEnv) (runmode.RunMode, error)
func NewTunnelConnection ¶
func NewTunnelConnection(mux *Mux, conn net.Conn, link *kubelink.Link, links kubelink.Links, handlers ...ConnectionFailHandler) (*TunnelConnection, *ConnectionHello, error)
func RegisterExtension ¶
func RegisterExtension(id byte, c ConnectionHelloExtensionHandler)
Types ¶
type APIExtension ¶
type APIExtension kubelink.LinkAccessInfo
func (*APIExtension) Data ¶
func (this *APIExtension) Data() []byte
func (*APIExtension) Id ¶
func (this *APIExtension) Id() byte
func (*APIExtension) String ¶
func (this *APIExtension) String() string
type APIExtensionHandler ¶
type APIExtensionHandler struct{}
func (*APIExtensionHandler) Add ¶
func (this *APIExtensionHandler) Add(hello *ConnectionHello, mux *Mux)
func (*APIExtensionHandler) Parse ¶
func (this *APIExtensionHandler) Parse(id byte, data []byte) (ConnectionHelloExtension, error)
type CertInfo ¶
type CertInfo struct { certs.CertificateSource // contains filtered or unexported fields }
func NewCertInfo ¶
func NewCertInfo(logger logger.LogContext, source certs.CertificateSource) *CertInfo
func (*CertInfo) ClientConfig ¶
func (*CertInfo) ServerConfig ¶
type ConnectionFailHandler ¶
type ConnectionFailHandler interface {
Notify(*TunnelConnection, error)
}
type ConnectionHandler ¶
type ConnectionHandler interface { UpdateAccess(hello *ConnectionHello) GetAccess() kubelink.LinkAccessInfo GetDNSInfo() kubelink.LinkDNSInfo }
type ConnectionHello ¶
type ConnectionHello struct { ConnectionHelloHeader Extensions map[byte]ConnectionHelloExtension Raw map[byte][]byte }
func NewConnectionHello ¶
func NewConnectionHello() *ConnectionHello
func ParseConnectionHello ¶
func ParseConnectionHello(logger logger.LogContext, header *ConnectionHelloHeader, data []byte) (*ConnectionHello, error)
func (*ConnectionHello) Data ¶
func (this *ConnectionHello) Data() []byte
type ConnectionHelloExtension ¶
func GetExtension ¶
func GetExtension(id byte, data []byte) (ConnectionHelloExtension, error)
type ConnectionHelloExtensionHandler ¶
type ConnectionHelloExtensionHandler interface { Parse(id byte, data []byte) (ConnectionHelloExtension, error) Add(hello *ConnectionHello, mux *Mux) }
type ConnectionHelloHeader ¶
func (*ConnectionHelloHeader) GetCIDR ¶
func (this *ConnectionHelloHeader) GetCIDR() *net.IPNet
func (*ConnectionHelloHeader) GetClusterAddress ¶
func (this *ConnectionHelloHeader) GetClusterAddress() *net.IPNet
func (*ConnectionHelloHeader) GetClusterIP ¶
func (this *ConnectionHelloHeader) GetClusterIP() net.IP
func (*ConnectionHelloHeader) GetExtensionLength ¶
func (this *ConnectionHelloHeader) GetExtensionLength() uint16
func (*ConnectionHelloHeader) GetPort ¶
func (this *ConnectionHelloHeader) GetPort() uint16
func (*ConnectionHelloHeader) SetCIDR ¶
func (this *ConnectionHelloHeader) SetCIDR(cidr *net.IPNet)
func (*ConnectionHelloHeader) SetClusterAddress ¶
func (this *ConnectionHelloHeader) SetClusterAddress(cidr *net.IPNet)
func (*ConnectionHelloHeader) SetExtensionLength ¶
func (this *ConnectionHelloHeader) SetExtensionLength(len uint16)
func (*ConnectionHelloHeader) SetPort ¶
func (this *ConnectionHelloHeader) SetPort(port uint16)
type DNSExtension ¶
type DNSExtension kubelink.LinkDNSInfo
func (*DNSExtension) Data ¶
func (this *DNSExtension) Data() []byte
func (*DNSExtension) Id ¶
func (this *DNSExtension) Id() byte
func (*DNSExtension) String ¶
func (this *DNSExtension) String() string
type DNSExtensionHandler ¶
type DNSExtensionHandler struct{}
func (*DNSExtensionHandler) Add ¶
func (this *DNSExtensionHandler) Add(hello *ConnectionHello, mux *Mux)
func (*DNSExtensionHandler) Parse ¶
func (this *DNSExtensionHandler) Parse(id byte, data []byte) (ConnectionHelloExtension, error)
type DefaultConnectionHandler ¶
type DefaultConnectionHandler struct {
// contains filtered or unexported fields
}
func NewDefaultConnectionHandler ¶
func NewDefaultConnectionHandler(runmode *mode) *DefaultConnectionHandler
func (*DefaultConnectionHandler) GetAccess ¶
func (this *DefaultConnectionHandler) GetAccess() kubelink.LinkAccessInfo
func (*DefaultConnectionHandler) GetDNSInfo ¶
func (this *DefaultConnectionHandler) GetDNSInfo() kubelink.LinkDNSInfo
func (*DefaultConnectionHandler) UpdateAccess ¶
func (this *DefaultConnectionHandler) UpdateAccess(hello *ConnectionHello)
type LinkStateHandler ¶
type Mux ¶
type Mux struct { logger.LogContext // contains filtered or unexported fields }
func (*Mux) AddTunnel ¶
func (this *Mux) AddTunnel(t *TunnelConnection)
func (*Mux) AssureTunnel ¶
func (this *Mux) AssureTunnel(logger logger.LogContext, link *kubelink.Link) (*TunnelConnection, error)
func (*Mux) FindConnection ¶
func (this *Mux) FindConnection(log logger.LogContext, packet []byte) *TunnelConnection
func (*Mux) GetConnectionForIP ¶
func (this *Mux) GetConnectionForIP(ip net.IP) (*TunnelConnection, error)
func (*Mux) Notify ¶
func (this *Mux) Notify(t *TunnelConnection, err error)
func (*Mux) QueryConnectionForIP ¶
func (*Mux) RegisterFailHandler ¶
func (this *Mux) RegisterFailHandler(handlers ...LinkStateHandler)
func (*Mux) RemoveTunnel ¶
func (this *Mux) RemoveTunnel(t *TunnelConnection)
func (*Mux) SetAutoConnect ¶
type Server ¶
type Server struct { logger.LogContext // contains filtered or unexported fields }
type TunnelConnection ¶
type TunnelConnection struct { logger.LogContext // contains filtered or unexported fields }
func (*TunnelConnection) ApplyLink ¶
func (this *TunnelConnection) ApplyLink(link kubelink.LinkName)
func (*TunnelConnection) Close ¶
func (this *TunnelConnection) Close() error
func (*TunnelConnection) ReadPacket ¶
func (this *TunnelConnection) ReadPacket(data []byte) (int, byte, error)
func (*TunnelConnection) RegisterStateHandler ¶
func (this *TunnelConnection) RegisterStateHandler(handlers ...ConnectionFailHandler)
func (*TunnelConnection) Send ¶
func (this *TunnelConnection) Send(packet []byte) error
func (*TunnelConnection) Serve ¶
func (this *TunnelConnection) Serve() error
func (*TunnelConnection) String ¶
func (this *TunnelConnection) String() string
func (*TunnelConnection) WritePacket ¶
func (this *TunnelConnection) WritePacket(ty byte, data []byte) error
Click to show internal directories.
Click to hide internal directories.