Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterNetwork(network string, handler TunHandler) (ok bool)
- func SendFrame(fiber Fiber, tp uint8, streamid uint16, v interface{}) (err error)
- type Addr
- type Client
- type Conn
- func (c *Conn) Accept() (err error)
- func (c *Conn) Close() (err error)
- func (c *Conn) Deny(errno int) (err error)
- func (c *Conn) Details() (s string)
- func (c *Conn) Final() (err error)
- func (c *Conn) GetStatus() (st string)
- func (c *Conn) GetStreamId() uint16
- func (c *Conn) GetTarget() (s string)
- func (c *Conn) HandleFrame(f *Frame) (err error)
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(data []byte) (n int, err error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) String() (s string)
- func (c *Conn) UpdateSpeed(interval int)
- func (c *Conn) Uptime() (s string)
- func (c *Conn) Write(data []byte) (n int, err error)
- type ConnSlice
- type DatagramConn
- type Fabric
- func (fab *Fabric) Close() (err error)
- func (fab *Fabric) Details() (s string)
- func (fab *Fabric) Final() (err error)
- func (fab *Fabric) GetConn(id uint16) (c *Conn, err error)
- func (fab *Fabric) GetConnections() (conns ConnSlice)
- func (fab *Fabric) GetSize() int
- func (fab *Fabric) HandleFrame(f *Frame) (err error)
- func (fab *Fabric) Loop()
- func (fab *Fabric) RunUpdateSpeed()
- func (fab *Fabric) String() string
- func (fab *Fabric) UpdateSpeed(interval int)
- func (fab *Fabric) Uptime() (s string)
- type Fiber
- type Frame
- type Header
- type Pulse
- type Queue
- type Server
- type Syn
- type TCPProxy
- type TunHandler
- type Tunnel
- type UDPProxy
Constants ¶
View Source
const ( ST_UNKNOWN = 0x00 ST_SYN = 0x01 ST_EST = 0x03 )
View Source
const ( MSG_UNKNOWN = iota MSG_SYN MSG_RESULT MSG_DATA MSG_WND MSG_FIN )
View Source
const ( ERR_NONE = iota ERR_IDEXIST ERR_CONNFAILED ERR_TIMEOUT ERR_CLOSED ERR_UNKNOWN_PROTOCOL )
View Source
const (
PULSEBUFSIZE = 64
)
Variables ¶
View Source
var ( ErrTypeError = errors.New("type dismatch") ErrFrameOverFlow = errors.New("marshal overflow in frame") ErrUnknownNetwork = errors.New("unknown network.") ErrStreamOutOfID = errors.New("stream out of id.") ErrUnexpectedPkg = errors.New("unexpected package.") ErrIdExist = errors.New("stream id exist.") ErrIdNotExist = errors.New("stream id not exist.") ErrState = errors.New("status error.") ErrNotImpl = errors.New("not implemented") ErrDialFailed = errors.New("dial failed") )
View Source
var ErrnoText = map[uint32]string{ ERR_NONE: "none", ERR_IDEXIST: "stream id existed", ERR_CONNFAILED: "connected failed", ERR_TIMEOUT: "timeout", ERR_CLOSED: "connect closed", ERR_UNKNOWN_PROTOCOL: "unknown network protocol", }
View Source
var (
MSG_OK = []byte{0x00}
)
View Source
var MsgText = map[uint8]string{ MSG_UNKNOWN: "UNKNOWN", MSG_SYN: "SYN", MSG_RESULT: "RESULT", MSG_DATA: "DATA", MSG_WND: "WND", MSG_FIN: "FIN", }
View Source
var Protocols map[string]TunHandler
View Source
var StatusText = map[uint8]string{ ST_UNKNOWN: "UNKNOWN", ST_SYN: "SYN", ST_EST: "ESTAB", }
Functions ¶
func RegisterNetwork ¶
func RegisterNetwork(network string, handler TunHandler) (ok bool)
FIXME: protocol pulse
Types ¶
type Client ¶
type Client struct { *Fabric // contains filtered or unexported fields }
func (*Client) DialTimeout ¶
type Conn ¶
type Conn struct { Network string Address string Tx int Rx int TxSpeed int RxSpeed int // contains filtered or unexported fields }
use lock to protect: status, window. SendFrame are not included.
func (*Conn) GetStreamId ¶
func (*Conn) HandleFrame ¶
func (*Conn) RemoteAddr ¶
func (*Conn) UpdateSpeed ¶
type DatagramConn ¶
type DatagramConn struct { *Conn // contains filtered or unexported fields }
func NewDatagramConn ¶
func NewDatagramConn(c *Conn) (dc *DatagramConn)
type Fabric ¶
type Fabric struct { net.Conn Tx int Rx int TxSpeed int RxSpeed int // contains filtered or unexported fields }
func (*Fabric) GetConnections ¶
func (*Fabric) HandleFrame ¶
func (*Fabric) RunUpdateSpeed ¶
func (fab *Fabric) RunUpdateSpeed()
func (*Fabric) UpdateSpeed ¶
type TunHandler ¶
Click to show internal directories.
Click to hide internal directories.