conn

package
v0.23.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2019 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accept added in v0.19.0

func Accept(l net.Listener, f func(c net.Conn))

func CopyWaitGroup added in v0.18.0

func CopyWaitGroup(conn1, conn2 net.Conn, crypt bool, snappy bool, rate *rate.Rate, flow *file.Flow, isServer bool, rb []byte)

conn1 mux conn

func GetConn added in v0.18.0

func GetConn(conn net.Conn, cpt, snappy bool, rt *rate.Rate, isServer bool) io.ReadWriteCloser

get crypt or snappy conn

func GetLenBytes

func GetLenBytes(buf []byte) (b []byte, err error)

get the assembled amount data(len 4 and content)

func NewKcpListenerAndProcess added in v0.19.0

func NewKcpListenerAndProcess(addr string, f func(c net.Conn)) error

func NewTcpListenerAndProcess added in v0.19.0

func NewTcpListenerAndProcess(addr string, f func(c net.Conn), listener *net.Listener) error

func SetUdpSession

func SetUdpSession(sess *kcp.UDPSession)

udp connection setting

Types

type Conn

type Conn struct {
	Conn net.Conn
	Rb   []byte
}

func NewConn

func NewConn(conn net.Conn) *Conn

new conn

func (*Conn) Close

func (s *Conn) Close() error

close

func (*Conn) GetAddStatus added in v0.0.15

func (s *Conn) GetAddStatus() (b bool)

get task or host result of add

func (*Conn) GetConfigInfo added in v0.0.15

func (s *Conn) GetConfigInfo() (c *file.Client, err error)

get task info

func (*Conn) GetHealthInfo added in v0.18.1

func (s *Conn) GetHealthInfo() (info string, status bool, err error)

get health info from conn

func (*Conn) GetHost

func (s *Conn) GetHost() (method, address string, rb []byte, err error, r *http.Request)

get host 、connection type、method...from connection

func (*Conn) GetHostInfo added in v0.0.15

func (s *Conn) GetHostInfo() (h *file.Host, err error)

get task info

func (*Conn) GetLen

func (s *Conn) GetLen() (int, error)

func (*Conn) GetLinkInfo

func (s *Conn) GetLinkInfo() (lk *Link, err error)

get link info from conn

func (*Conn) GetShortContent added in v0.18.0

func (s *Conn) GetShortContent(l int) (b []byte, err error)

func (*Conn) GetShortLenContent added in v0.18.0

func (s *Conn) GetShortLenContent() (b []byte, err error)

func (*Conn) GetTaskInfo

func (s *Conn) GetTaskInfo() (t *file.Tunnel, err error)

get task info

func (*Conn) LocalAddr added in v0.21.0

func (s *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (s *Conn) Read(b []byte) (n int, err error)

read

func (*Conn) ReadFlag

func (s *Conn) ReadFlag() (string, error)

read flag

func (*Conn) ReadLen

func (s *Conn) ReadLen(cLen int, buf []byte) (int, error)

读取指定长度内容

func (*Conn) RemoteAddr added in v0.21.0

func (s *Conn) RemoteAddr() net.Addr

func (*Conn) SendHealthInfo added in v0.18.1

func (s *Conn) SendHealthInfo(info, status string) (int, error)

send info for link

func (*Conn) SendInfo added in v0.21.0

func (s *Conn) SendInfo(t interface{}, flag string) (int, error)

send info

func (*Conn) SetAlive

func (s *Conn) SetAlive(tp string)

set alive

func (*Conn) SetDeadline added in v0.21.0

func (s *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (s *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetReadDeadlineBySecond added in v0.21.0

func (s *Conn) SetReadDeadlineBySecond(t time.Duration)

set read deadline

func (*Conn) SetWriteDeadline added in v0.21.0

func (s *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (s *Conn) Write(b []byte) (int, error)

write

func (*Conn) WriteAddFail added in v0.0.15

func (s *Conn) WriteAddFail() error

func (*Conn) WriteAddOk added in v0.0.15

func (s *Conn) WriteAddOk() error

func (*Conn) WriteChan

func (s *Conn) WriteChan() (int, error)

write chan

func (*Conn) WriteClose

func (s *Conn) WriteClose() (int, error)

write sign flag

func (*Conn) WriteConfig added in v0.0.15

func (s *Conn) WriteConfig() (int, error)

write main

func (*Conn) WriteLenContent added in v0.18.0

func (s *Conn) WriteLenContent(buf []byte) (err error)

func (*Conn) WriteMain

func (s *Conn) WriteMain() (int, error)

write main

type LenConn added in v0.22.3

type LenConn struct {
	Len int
	// contains filtered or unexported fields
}

func NewLenConn added in v0.22.3

func NewLenConn(conn io.Writer) *LenConn

func (*LenConn) Write added in v0.22.3

func (c *LenConn) Write(p []byte) (n int, err error)
type Link struct {
	ConnType   string //连接类型
	Host       string //目标
	Crypt      bool   //加密
	Compress   bool
	LocalProxy bool
	RemoteAddr string
}
func NewLink(connType string, host string, crypt bool, compress bool, remoteAddr string, localProxy bool) *Link

type Secret added in v0.0.16

type Secret struct {
	Password string
	Conn     *Conn
}

func NewSecret added in v0.0.16

func NewSecret(p string, conn *Conn) *Secret

type SnappyConn

type SnappyConn struct {
	// contains filtered or unexported fields
}

func NewSnappyConn

func NewSnappyConn(conn io.ReadWriteCloser) *SnappyConn

func (*SnappyConn) Close added in v0.18.0

func (s *SnappyConn) Close() error

func (*SnappyConn) Read

func (s *SnappyConn) Read(b []byte) (n int, err error)

snappy压缩读

func (*SnappyConn) Write

func (s *SnappyConn) Write(b []byte) (n int, err error)

snappy压缩写

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL