conn

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Join

func Join(c1 *Conn, c2 *Conn)

will block until connection close

func JoinMore added in v0.3.0

func JoinMore(c1 *Conn, c2 *Conn, cryptKey string)

messages from c1 to c2 will be encrypted and from c2 to c1 will be decrypted

func PipeDecrypt added in v0.3.0

func PipeDecrypt(r net.Conn, w net.Conn, key string) error

decrypt msg from reader, then write into writer

func PipeEncrypt added in v0.3.0

func PipeEncrypt(r net.Conn, w net.Conn, key string) error

recvive msg from reader, then encrypt msg into write

Types

type Conn

type Conn struct {
	TcpConn net.Conn
	Reader  *bufio.Reader
	// contains filtered or unexported fields
}

wrap for TCPConn

func ConnectServer

func ConnectServer(host string, port int64) (c *Conn, err error)

func NewConn added in v0.5.0

func NewConn(conn net.Conn) (c *Conn)

func (*Conn) Close

func (c *Conn) Close()

func (*Conn) GetLocalAddr

func (c *Conn) GetLocalAddr() (addr string)

func (*Conn) GetRemoteAddr

func (c *Conn) GetRemoteAddr() (addr string)

func (*Conn) IsClosed

func (c *Conn) IsClosed() (closeFlag bool)

func (*Conn) ReadLine

func (c *Conn) ReadLine() (buff string, err error)

func (*Conn) SetDeadline added in v0.5.0

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

func (*Conn) Write

func (c *Conn) Write(content string) (err error)

type Listener

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

func Listen

func Listen(bindAddr string, bindPort int64) (l *Listener, err error)

func (*Listener) Accept added in v0.5.0

func (l *Listener) Accept() (*Conn, error)

wait util get one new connection or listener is closed if listener is closed, err returned

func (*Listener) Close

func (l *Listener) Close() error

Jump to

Keyboard shortcuts

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