net

package
v0.8.698 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: Apache-2.0 Imports: 11 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	net.Conn
	log.Logger
}

Conn is the interface of connections used in frp.

func ConnectTcpServer

func ConnectTcpServer(addr string) (c Conn, err error)

func ConnectTcpServerByHttpProxy

func ConnectTcpServerByHttpProxy(httpProxy string, serverAddr string) (c Conn, err error)

ConnectTcpServerByHttpProxy try to connect remote server by http proxy. If httpProxy is empty, it will connect server directly.

func WrapConn

func WrapConn(c net.Conn) Conn

func WrapReadWriteCloserToConn

func WrapReadWriteCloserToConn(rwc io.ReadWriteCloser) Conn

type FakeUdpConn

type FakeUdpConn struct {
	log.Logger
	// contains filtered or unexported fields
}

func NewFakeUdpConn

func NewFakeUdpConn(l *UdpListener, laddr, raddr net.Addr) *FakeUdpConn

func (*FakeUdpConn) Close

func (c *FakeUdpConn) Close() error

func (*FakeUdpConn) IsClosed

func (c *FakeUdpConn) IsClosed() bool

func (*FakeUdpConn) LocalAddr

func (c *FakeUdpConn) LocalAddr() net.Addr

func (*FakeUdpConn) Read

func (c *FakeUdpConn) Read(b []byte) (n int, err error)

func (*FakeUdpConn) RemoteAddr

func (c *FakeUdpConn) RemoteAddr() net.Addr

func (*FakeUdpConn) SetDeadline

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

func (*FakeUdpConn) SetReadDeadline

func (c *FakeUdpConn) SetReadDeadline(t time.Time) error

func (*FakeUdpConn) SetWriteDeadline

func (c *FakeUdpConn) SetWriteDeadline(t time.Time) error

func (*FakeUdpConn) Write

func (c *FakeUdpConn) Write(b []byte) (n int, err error)

type Listener

type Listener interface {
	Accept() (Conn, error)
	Close() error
	log.Logger
}

type TcpConn

type TcpConn struct {
	net.Conn
	log.Logger
}

Wrap for TCPConn.

func NewTcpConn

func NewTcpConn(conn *net.TCPConn) (c *TcpConn)

type TcpListener

type TcpListener struct {
	net.Addr

	log.Logger
	// contains filtered or unexported fields
}

func ListenTcp

func ListenTcp(bindAddr string, bindPort int64) (l *TcpListener, err error)

func (*TcpListener) Accept

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

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

func (*TcpListener) Close

func (l *TcpListener) Close() error

type UdpListener

type UdpListener struct {
	net.Addr

	log.Logger
	// contains filtered or unexported fields
}

func ListenUDP

func ListenUDP(bindAddr string, bindPort int64) (l *UdpListener, err error)

func (*UdpListener) Accept

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

func (*UdpListener) Close

func (l *UdpListener) Close() error

func (*UdpListener) WriteMsg

func (l *UdpListener) WriteMsg(buf []byte, remoteAddr *net.UDPAddr) (err error)

type UdpPacket

type UdpPacket struct {
	Buf        []byte
	LocalAddr  net.Addr
	RemoteAddr net.Addr
}

type WrapLogConn

type WrapLogConn struct {
	net.Conn
	log.Logger
}

type WrapReadWriteCloserConn

type WrapReadWriteCloserConn struct {
	io.ReadWriteCloser
	log.Logger
}

func (*WrapReadWriteCloserConn) LocalAddr

func (conn *WrapReadWriteCloserConn) LocalAddr() net.Addr

func (*WrapReadWriteCloserConn) RemoteAddr

func (conn *WrapReadWriteCloserConn) RemoteAddr() net.Addr

func (*WrapReadWriteCloserConn) SetDeadline

func (conn *WrapReadWriteCloserConn) SetDeadline(t time.Time) error

func (*WrapReadWriteCloserConn) SetReadDeadline

func (conn *WrapReadWriteCloserConn) SetReadDeadline(t time.Time) error

func (*WrapReadWriteCloserConn) SetWriteDeadline

func (conn *WrapReadWriteCloserConn) SetWriteDeadline(t time.Time) error

Jump to

Keyboard shortcuts

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