Documentation ¶
Index ¶
- Constants
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(s int) string
- func GenerateSocks5Req(task *TaskInfo) *socks5.Request
- func ReadBytes(r io.Reader, count int) ([]byte, error)
- func ReadShortString(r io.Reader) (string, error)
- func ReadString(r io.Reader) (string, error)
- func ReadUint32(r io.Reader) (uint32, error)
- func ReadUint8(r io.Reader) (uint8, error)
- func WriteShortString(w io.Writer, str string) error
- func WriteString(w io.Writer, str string) error
- type AgentConfig
- type ClientConfig
- type IMux
- type ListenerConfig
- type MultiMux
- type ProxyInfo
- type Router
- type TaskInfo
- type TaskType
- type Tether
- type TetherConfig
- type TunnelTask
Constants ¶
const ( TaskTypeSocks = iota //TaskTypeUpdateConfig //TaskTypeVpn TaskTypePing )
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateSocks5Req ¶
func GenerateSocks5Req(task *TaskInfo) *socks5.Request
Types ¶
type AgentConfig ¶
type AgentConfig struct { Servers []ListenerConfig `json:"servers"` Connections []TetherConfig `json:"tethers"` NetworkConfiguration ClientConfig `json:"netConf"` Proxy *ProxyInfo `json:"proxy,omitempty"` NumConnsPerTether int `json:"numConnsPerTether"` }
type ClientConfig ¶
type ListenerConfig ¶
type MultiMux ¶
type MultiMux struct {
// contains filtered or unexported fields
}
MultiMux is a client for multiple mux channels, it presents a facade which makes multiple channels seem like one channel
func NewMultiMux ¶
NewMultiMux creates a new multi connection mux
func (*MultiMux) Accept ¶
Accept returns an incoming client connection or waits until one is initiated
func (*MultiMux) AddConnection ¶
func (m *MultiMux) AddConnection(c io.ReadWriteCloser)
AddConnection adds a connection to the multi-mux
type Router ¶
type Router struct { NetworkConfig *ClientConfig AuthenticateSocks5 bool Proxy *ProxyInfo // contains filtered or unexported fields }
Router holds all connections for the current snap-node, along with the network configuration & routing logic it recieves network connections and routes them to the correct destination
func (*Router) Connect ¶
func (rtr *Router) Connect(connConf *TetherConfig, numConnsPerTether int) error
Connect creates a new bundle of physical connections to the server (AKA: thether)
func (*Router) Serve ¶
func (rtr *Router) Serve(serverConf ListenerConfig) error
Serve creates a listener of given type and runs it on the given port
type Tether ¶
type Tether struct { IMux RemoteConfig *ClientConfig }
Tether is a generalized network connection for tunneling it usually holds a bundle of connections, multiplexed into endless virtual connections along with any additional information about the remote part of the call
type TetherConfig ¶
type TunnelTask ¶
func NewTunnelTask ¶
func NewTunnelTask(conn net.Conn, taskInfo *TaskInfo) *TunnelTask
NewTunnelTask creates a new TunnelTask
func ReadTunnelTask ¶
func ReadTunnelTask(conn net.Conn) (*TunnelTask, error)
ReadTunnelTask reads the task details from the connection and returns a new TunnelTask object
func (*TunnelTask) PrefixSend ¶
func (t *TunnelTask) PrefixSend(b []byte) (int, error)
PrefixSend adds bytes to be sent before the connections are welded
func (*TunnelTask) PrefixTaskInfo ¶
func (t *TunnelTask) PrefixTaskInfo() error
PrefixTaskInfo the task info onto the head of the stream to be sent
func (*TunnelTask) Read ¶
func (t *TunnelTask) Read(b []byte) (int, error)
Read overrides the connection read to send the prefixed content first
func (*TunnelTask) ReadPresend ¶
func (t *TunnelTask) ReadPresend() []byte
ReadPresend returns the bytes that are in the presend buffer and zeroes it