ccsocks5

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Associate

type Associate struct {
	*Client
}

Associate implement sock5 associate command

func (*Associate) File

func (sf *Associate) File() (f *os.File, err error)

File returns a copy of the underlying os.File.

func (*Associate) ReadFrom

func (sf *Associate) ReadFrom(b []byte) (int, net.Addr, error)

ReadFrom implements the PacketConn ReadFrom method.

func (*Associate) ReadFromUDP

func (sf *Associate) ReadFromUDP(b []byte) (n int, addr *net.UDPAddr, err error)

ReadFromUDP acts like ReadFrom but returns a UDPAddr.

func (*Associate) ReadMsgUDP

func (sf *Associate) ReadMsgUDP(b, oob []byte) (n, oobn, flags int, addr *net.UDPAddr, err error)

ReadMsgUDP reads a message from c, copying the payload into b and the associated out-of-band data into oob.

func (*Associate) SetReadBuffer

func (sf *Associate) SetReadBuffer(bytes int) error

SetReadBuffer sets the size of the operating system's receive buffer associated with the connection.

func (*Associate) SetWriteBuffer

func (sf *Associate) SetWriteBuffer(bytes int) error

SetWriteBuffer sets the size of the operating system's transmit buffer associated with the connection.

func (*Associate) WriteMsgUDP

func (sf *Associate) WriteMsgUDP(b, oob []byte, addr *net.UDPAddr) (n, oobn int, err error)

WriteMsgUDP writes a message to addr via c if c isn't connected, or to c's remote address if c is connected (in which case addr must be nil)

func (*Associate) WriteTo

func (sf *Associate) WriteTo(b []byte, addr net.Addr) (int, error)

WriteTo implements the PacketConn WriteTo method.

func (*Associate) WriteToUDP

func (sf *Associate) WriteToUDP(b []byte, addr *net.UDPAddr) (int, error)

WriteToUDP acts like WriteTo but takes a UDPAddr.

type Client

type Client struct {

	// real server connection udp/tcp
	net.Conn
	// contains filtered or unexported fields
}

Client is socks5 client.

func NewClient

func NewClient(proxyAddr string, opts ...Option) *Client

NewClient This is just create a client. you need to use Dial to create conn.

func (*Client) Close

func (sf *Client) Close() (err error)

Close closes the connection.

func (*Client) Dial

func (sf *Client) Dial(network, addr string) (net.Conn, error)

Dial connects to the address on the named network through proxy , with socks5 handshake.

func (*Client) DialTCP

func (sf *Client) DialTCP(network, addr string) (net.Conn, error)

DialTCP connects to the address on the named network through proxy , with socks5 handshake.

func (*Client) DialUDP

func (sf *Client) DialUDP(network string, laddr *net.UDPAddr, raddr string) (net.Conn, error)

DialUDP connects to the address on the named network through proxy , with socks5 handshake.

func (*Client) SetKeepAlive added in v0.1.1

func (sf *Client) SetKeepAlive(keepalive bool) error

SetKeepAlive sets whether the operating system should send keep-alive messages on the connection.

func (*Client) SetKeepAlivePeriod added in v0.1.1

func (sf *Client) SetKeepAlivePeriod(d time.Duration) error

SetKeepAlivePeriod sets period between keep-alives.

type Connect

type Connect struct {
	*Client
}

Connect implement sock5 connect command

func (*Connect) CloseRead

func (sf *Connect) CloseRead() error

CloseRead shuts down the reading side of the TCP connection. Most callers should just use Close.

func (*Connect) CloseWrite

func (sf *Connect) CloseWrite() error

CloseWrite shuts down the writing side of the TCP connection. Most callers should just use Close.

func (*Connect) File

func (sf *Connect) File() (f *os.File, err error)

File returns a copy of the underlying os.File.

func (*Connect) ReadFrom

func (sf *Connect) ReadFrom(r io.Reader) (int64, error)

ReadFrom implements the io.ReaderFrom ReadFrom method.

func (*Connect) SetKeepAlive

func (sf *Connect) SetKeepAlive(keepalive bool) error

SetKeepAlive sets whether the operating system should send keep-alive messages on the connection.

func (*Connect) SetKeepAlivePeriod

func (sf *Connect) SetKeepAlivePeriod(d time.Duration) error

SetKeepAlivePeriod sets period between keep-alives.

func (*Connect) SetLinger

func (sf *Connect) SetLinger(sec int) error

SetLinger sets the behavior of Close on a connection which still has data waiting to be sent or to be acknowledged.

func (*Connect) SetNoDelay

func (sf *Connect) SetNoDelay(noDelay bool) error

SetNoDelay controls whether the operating system should delay packet transmission in hopes of sending fewer packets (Nagle's algorithm). The default is true (no delay), meaning that data is sent as soon as possible after a Write.

func (*Connect) SetReadBuffer

func (sf *Connect) SetReadBuffer(bytes int) error

SetReadBuffer sets the size of the operating system's receive buffer associated with the connection.

func (*Connect) SetWriteBuffer

func (sf *Connect) SetWriteBuffer(bytes int) error

SetWriteBuffer sets the size of the operating system's transmit buffer associated with the connection.

type Option

type Option func(c *Client)

Option user's option of the client

func WithAuth

func WithAuth(auth *proxy.Auth) Option

WithAuth with user's auth default is nil,no UserPass

func WithBufferPool

func WithBufferPool(p bufferpool.BufPool) Option

WithBufferPool with buffer pool default: 32k

Jump to

Keyboard shortcuts

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