Documentation ¶
Index ¶
- Constants
- Variables
- func LoadPassfile(filename string) (userpass map[string]string, err error)
- func ReadString(r io.Reader) (s string, err error)
- func RecvWithTimeout(ch chan uint32, t time.Duration) (errno uint32)
- func WriteString(w io.Writer, s string) (err error)
- type Addr
- type Conn
- func (c *Conn) Close() (err error)
- func (c *Conn) CloseFrame() error
- func (c *Conn) Final()
- func (c *Conn) GetId() (s string)
- func (c *Conn) GetReadBufSize() (n uint32)
- func (c *Conn) GetStatus() (st string)
- func (c *Conn) GetStreamId() (s string)
- func (c *Conn) GetWriteBufSize() (n uint32)
- func (c *Conn) InConnect(errno uint32) (err error)
- func (c *Conn) InData(ft *FrameData) (err error)
- func (c *Conn) InFin(ft *FrameFin) (err error)
- func (c *Conn) InWnd(ft *FrameWnd) (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) SendFrame(f Frame) (err error)
- 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) WaitForConn(address string) (err error)
- func (c *Conn) Write(data []byte) (n int, err error)
- func (c *Conn) WriteSlice(data []byte) (err error)
- type Dialer
- type Frame
- type FrameAuth
- type FrameBase
- type FrameData
- type FrameFin
- type FramePing
- type FrameResult
- type FrameRst
- type FrameSender
- type FrameSyn
- type FrameWnd
- type MsocksService
- type PingPong
- type Queue
- type Session
- func (s *Session) Close() (err error)
- func (s *Session) CloseFrame() error
- func (s *Session) Dial(network, address string) (c *Conn, err error)
- func (s *Session) GetId() string
- func (s *Session) GetPorts() (ports []*Conn)
- func (s *Session) GetReadSpeed() int64
- func (s *Session) GetSize() int
- func (s *Session) GetWriteSpeed() int64
- func (s *Session) LocalAddr() net.Addr
- func (s *Session) LocalPort() int
- func (s *Session) PutIntoId(id uint16, fs FrameSender) (err error)
- func (s *Session) PutIntoNextId(fs FrameSender) (id uint16, err error)
- func (s *Session) RemoteAddr() net.Addr
- func (s *Session) RemovePorts(streamid uint16) (err error)
- func (s *Session) Run()
- func (s *Session) SendFrame(f Frame) (err error)
- type SessionMaker
- type SessionPool
Constants ¶
View Source
const ( ST_UNKNOWN = iota ST_SYN_RECV ST_SYN_SENT ST_EST ST_CLOSE_WAIT ST_FIN_WAIT )
View Source
const ( MSG_UNKNOWN = iota MSG_RESULT MSG_AUTH MSG_DATA MSG_SYN MSG_WND MSG_FIN MSG_RST MSG_PING MSG_DNS MSG_ADDRS )
View Source
const ( PINGTIME = 5000 PINGRANDOM = 1000 TIMEOUT_COUNT = 6 GAMEOVER_COUNT = 60 DIAL_RETRY = 6 DIAL_TIMEOUT = 30000 WINDOWSIZE = 2 * 1024 * 1024 AUTH_TIMEOUT = 5000 MIN_SESS_NUM = 2 MAX_CONN_PRE_SESS = 16 SHRINK_TIME = 5000 SHRINK_RATE = 0.9 )
View Source
const ( ERR_NONE = iota ERR_AUTH ERR_IDEXIST ERR_CONNFAILED ERR_TIMEOUT ERR_CLOSED )
Variables ¶
View Source
var ( ErrStreamNotExist = errors.New("stream not exist.") ErrQueueClosed = errors.New("queue closed") ErrUnexpectedPkg = errors.New("unexpected package") ErrNotSyn = errors.New("frame result in conn which status is not syn") ErrFinState = errors.New("status not est or fin wait when get fin") ErrIdExist = errors.New("frame sync stream id exist.") ErrState = errors.New("status error") ErrSessionNotFound = errors.New("session not found") )
Functions ¶
Types ¶
type Conn ¶
type Conn struct { Address string // contains filtered or unexported fields }
func (*Conn) CloseFrame ¶
func (*Conn) GetReadBufSize ¶
func (*Conn) GetStreamId ¶
func (*Conn) GetWriteBufSize ¶
func (*Conn) RemoteAddr ¶
func (*Conn) WaitForConn ¶
func (*Conn) WriteSlice ¶
type Dialer ¶
type Dialer struct { SessionPool sutils.Dialer // contains filtered or unexported fields }
type Frame ¶
type FrameAuth ¶
func NewFrameAuth ¶
type FrameBase ¶
func (*FrameBase) GetStreamid ¶
type FrameData ¶
func NewFrameData ¶
type FramePing ¶
type FramePing struct {
FrameBase
}
func NewFramePing ¶
func NewFramePing() (f *FramePing)
type FrameResult ¶
func NewFrameResult ¶
func NewFrameResult(streamid uint16, errno uint32) (f *FrameResult)
type FrameSender ¶
type FrameSyn ¶
func NewFrameSyn ¶
type FrameWnd ¶
func NewFrameWnd ¶
type MsocksService ¶
type MsocksService struct { SessionPool // contains filtered or unexported fields }
func NewService ¶
func (*MsocksService) Handler ¶
func (ms *MsocksService) Handler(conn net.Conn)
type PingPong ¶
type PingPong struct {
// contains filtered or unexported fields
}
func NewPingPong ¶
func NewPingPong(sender FrameSender) (p *PingPong)
func (*PingPong) GetLastPing ¶
func (*PingPong) IsGameOver ¶
type Session ¶
type Session struct { PingPong // contains filtered or unexported fields }
func DialSession ¶
func NewSession ¶
func (*Session) CloseFrame ¶
func (*Session) GetReadSpeed ¶
func (*Session) GetWriteSpeed ¶
func (*Session) PutIntoNextId ¶
func (s *Session) PutIntoNextId(fs FrameSender) (id uint16, err error)
func (*Session) RemoteAddr ¶
func (*Session) RemovePorts ¶
type SessionMaker ¶
type SessionPool ¶
type SessionPool struct {
// contains filtered or unexported fields
}
func CreateSessionPool ¶
func CreateSessionPool(sm SessionMaker) (sp SessionPool)
func (*SessionPool) Add ¶
func (sp *SessionPool) Add(s *Session)
func (*SessionPool) CutAll ¶
func (sp *SessionPool) CutAll()
func (*SessionPool) GetOrCreateSess ¶
func (sp *SessionPool) GetOrCreateSess() (sess *Session)
func (*SessionPool) GetSess ¶
func (sp *SessionPool) GetSess() (sess []*Session)
func (*SessionPool) GetSize ¶
func (sp *SessionPool) GetSize() int
Click to show internal directories.
Click to hide internal directories.