Documentation ¶
Index ¶
- Constants
- Variables
- func NewListener(raw net.Listener, auth *map[string]string) (listener net.Listener)
- 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 ChanFrameSender
- type Conn
- func (c *Conn) CheckAndSetStatus(old uint8, new uint8) (err error)
- func (c *Conn) Close() (err error)
- func (c *Conn) CloseFrame() error
- func (c *Conn) Final()
- func (c *Conn) GetAddress() (s string)
- func (c *Conn) GetReadBufSize() (n int32)
- func (c *Conn) GetStatusString() (st string)
- func (c *Conn) GetStreamId() uint16
- func (c *Conn) GetWriteBufSize() (n int32)
- 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) SendSynAndWait() (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) String() (s string)
- func (c *Conn) Write(data []byte) (n int, err error)
- type ConnSlice
- type DialerCreator
- type Frame
- type FrameAuth
- type FrameBase
- type FrameData
- type FrameDns
- type FrameFin
- type FramePing
- type FrameResult
- type FrameRst
- type FrameSender
- type FrameSpam
- type FrameSyn
- type FrameWnd
- type Listener
- 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) Exchange(quiz *dns.Msg) (resp *dns.Msg, err error)
- func (s *Session) GetPorts() (ports []*Conn)
- func (s *Session) GetSize() int
- func (s *Session) GetSortedPorts() (ports ConnSlice)
- 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) RemovePort(streamid uint16) (err error)
- func (s *Session) Run()
- func (s *Session) SendFrame(f Frame) (err error)
- func (s *Session) String() string
- type SpeedCounter
Constants ¶
View Source
const ( AUTH_TIMEOUT = 10000 DIAL_TIMEOUT = 30000 DNS_TIMEOUT = 30000 WRITE_TIMEOUT = 60000 WINDOWSIZE = 4 * 1024 * 1024 )
View Source
const ( ERR_NONE = iota ERR_AUTH ERR_IDEXIST ERR_CONNFAILED ERR_TIMEOUT ERR_CLOSED )
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_SPAM )
Variables ¶
View Source
var ( ErrAuthFailed = errors.New("auth failed %s.") ErrAuthTimeout = errors.New("auth timeout %s.") 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.") ErrUnknownState = errors.New("unknown status.") ErrChanClosed = errors.New("chan closed.") ErrDnsTimeOut = errors.New("dns timeout.") ErrDnsMsgIllegal = errors.New("dns message illegal.") ErrDnsLookuper = errors.New("dns lookuper can't exchange.") ErrNoDnsServer = errors.New("no proper dns server.") )
Functions ¶
func NewListener ¶
Types ¶
type ChanFrameSender ¶
type ChanFrameSender chan Frame
func CreateChanFrameSender ¶
func CreateChanFrameSender(n int) ChanFrameSender
func (*ChanFrameSender) CloseFrame ¶
func (cfs *ChanFrameSender) CloseFrame() (err error)
func (*ChanFrameSender) RecvWithTimeout ¶
func (cfs *ChanFrameSender) RecvWithTimeout(t time.Duration) (f Frame, err error)
func (*ChanFrameSender) SendFrame ¶
func (cfs *ChanFrameSender) SendFrame(f Frame) (err error)
type Conn ¶
func (*Conn) CloseFrame ¶
func (*Conn) GetAddress ¶
func (*Conn) GetReadBufSize ¶
func (*Conn) GetStatusString ¶
func (*Conn) GetStreamId ¶
func (*Conn) GetWriteBufSize ¶
func (*Conn) RemoteAddr ¶
func (*Conn) SendSynAndWait ¶
type DialerCreator ¶
func NewDialerCreator ¶
func NewDialerCreator(raw sutils.Dialer, serveraddr, username, password string) (dc *DialerCreator)
func (*DialerCreator) Create ¶
func (dc *DialerCreator) Create() (sess *Session, err error)
type Frame ¶
type FrameAuth ¶
func NewFrameAuth ¶
type FrameBase ¶
func (*FrameBase) GetStreamid ¶
type FrameDns ¶
func NewFrameDns ¶
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 Session ¶
type Session struct { *sutils.ExchangerToLookuper net.Conn Readcnt *SpeedCounter Writecnt *SpeedCounter // contains filtered or unexported fields }
func (*Session) CloseFrame ¶
func (*Session) GetSortedPorts ¶
func (*Session) PutIntoNextId ¶
func (s *Session) PutIntoNextId(fs FrameSender) (id uint16, err error)
func (*Session) RemovePort ¶
type SpeedCounter ¶
func NewSpeedCounter ¶
func NewSpeedCounter() (sc *SpeedCounter)
func (*SpeedCounter) Add ¶
func (sc *SpeedCounter) Add(s uint32) uint32
func (*SpeedCounter) Close ¶
func (sc *SpeedCounter) Close() error
func (*SpeedCounter) Update ¶
func (sc *SpeedCounter) Update()
Click to show internal directories.
Click to hide internal directories.