net

package
v0.0.0-...-88de051 Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCrypt

func GetCrypt(crypt string, key string, salt string) (kcp.BlockCrypt, error)

func HttpBasicAuth

func HttpBasicAuth(h http.HandlerFunc, user, passwd string) http.HandlerFunc

func HttprouterBasicAuth

func HttprouterBasicAuth(h httprouter.Handle, user, passwd string) httprouter.Handle

func MakeHttpGzipHandler

func MakeHttpGzipHandler(h http.Handler) http.Handler

func NewHttpBasicAuthWraper

func NewHttpBasicAuthWraper(h http.Handler, user, passwd string) http.Handler

Types

type Conn

type Conn interface {
	net.Conn
}

Conn is the interface of connections used in frp.

func ConnectServer

func ConnectServer(protocol string, addr string) (c Conn, err error)

func ConnectServerByHttpProxy

func ConnectServerByHttpProxy(httpProxy string, protocol string, addr string) (c Conn, err error)

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 CustomListener

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

Custom listener

func NewCustomListener

func NewCustomListener() *CustomListener

func (*CustomListener) Accept

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

func (*CustomListener) Addr

func (l *CustomListener) Addr() net.Addr

func (*CustomListener) Close

func (l *CustomListener) Close() error

func (*CustomListener) PutConn

func (l *CustomListener) PutConn(conn Conn) error

type FakeUdpConn

type FakeUdpConn struct {
	// 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 HttpAuthWraper

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

func (*HttpAuthWraper) ServeHTTP

func (aw *HttpAuthWraper) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HttpGzipWraper

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

func (*HttpGzipWraper) ServeHTTP

func (gw *HttpGzipWraper) ServeHTTP(w http.ResponseWriter, r *http.Request)

type KcpListener

type KcpListener struct {
	net.Addr
	// contains filtered or unexported fields
}

func ListenKcp

func ListenKcp(bindAddr string) (l *KcpListener, err error)

func (*KcpListener) Accept

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

func (*KcpListener) Close

func (l *KcpListener) Close() error

type Listener

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

func WrapLogListener

func WrapLogListener(l net.Listener) Listener

type LogListener

type LogListener struct {
	net.Listener
	// contains filtered or unexported fields
}

func (*LogListener) Accept

func (logL *LogListener) Accept() (Conn, error)

type SharedConn

type SharedConn struct {
	Conn
	sync.Mutex
	// contains filtered or unexported fields
}

func NewShareConn

func NewShareConn(conn Conn) (*SharedConn, io.Reader)

the bytes you read in io.Reader, will be reserved in SharedConn

func (*SharedConn) Read

func (sc *SharedConn) Read(p []byte) (n int, err error)

func (*SharedConn) WriteBuff

func (sc *SharedConn) WriteBuff(buffer []byte) (err error)

type TcpConn

type TcpConn struct {
	net.Conn
}

Wrap for TCPConn.

func NewTcpConn

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

type TcpListener

type TcpListener struct {
	net.Addr
	// contains filtered or unexported fields
}

func ListenTcp

func ListenTcp(bindAddr string) (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
	// contains filtered or unexported fields
}

func ListenUDP

func ListenUDP(bindAddr string) (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
}

type WrapReadWriteCloserConn

type WrapReadWriteCloserConn struct {
	io.ReadWriteCloser
}

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