Documentation
¶
Index ¶
- type Authentication
- type AuthenticationFunc
- type BytesPool
- type Command
- type Dialer
- type Logger
- type Server
- type SimpleServer
- type UDPConn
- func (c *UDPConn) Read(b []byte) (int, error)
- func (c *UDPConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)
- func (c *UDPConn) ReadFromUDP(b []byte) (n int, addr *net.UDPAddr, err error)
- func (c *UDPConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error)
- func (c *UDPConn) ReadMsgUDP(b, oob []byte) (n, oobn, flags int, addr *net.UDPAddr, err error)
- func (c *UDPConn) ReadMsgUDPAddrPort(b, oob []byte) (n, oobn, flags int, addr netip.AddrPort, err error)
- func (c *UDPConn) RemoteAddr() net.Addr
- func (c *UDPConn) SetDeadline(t time.Time) error
- func (c *UDPConn) SetReadBuffer(bytes int) error
- func (c *UDPConn) SetReadDeadline(t time.Time) error
- func (c *UDPConn) SetWriteBuffer(bytes int) error
- func (c *UDPConn) SetWriteDeadline(t time.Time) error
- func (c *UDPConn) Write(b []byte) (int, error)
- func (c *UDPConn) WriteMsgUDP(b, oob []byte, addr *net.UDPAddr) (n, oobn int, err error)
- func (c *UDPConn) WriteMsgUDPAddrPort(b, oob []byte, addr netip.AddrPort) (n, oobn int, err error)
- func (c *UDPConn) WriteTo(p []byte, addr net.Addr) (n int, err error)
- func (c *UDPConn) WriteToUDP(b []byte, addr *net.UDPAddr) (int, error)
- func (c *UDPConn) WriteToUDPAddrPort(b []byte, addr netip.AddrPort) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
Authentication proxy authentication
func UserAuth ¶
func UserAuth(username, password string) Authentication
UserAuth basic authentication
type AuthenticationFunc ¶
AuthenticationFunc Authentication interface is implemented
type BytesPool ¶ added in v0.2.2
BytesPool is an interface for getting and returning temporary bytes for use by io.CopyBuffer.
type Dialer ¶
type Dialer struct { // ProxyNetwork network between a proxy server and a client ProxyNetwork string // ProxyAddress proxy server address ProxyAddress string // ProxyDial specifies the optional dial function for // establishing the transport connection. ProxyDial func(ctx context.Context, network string, address string) (net.Conn, error) // ProxyPacketDial specifies the optional proxyPacketDial function for // establishing the transport connection. ProxyPacketDial func(ctx context.Context, network string, address string) (net.PacketConn, error) // Username use username authentication if not empty Username string // Password use password authentication if not empty, // only valid if username is set Password string // IsResolve resolve domain name on locally IsResolve bool // Resolver optionally specifies an alternate resolver to use Resolver *net.Resolver // Timeout is the maximum amount of time a dial will wait for // a connect to complete. The default is no timeout Timeout time.Duration }
Dialer is a SOCKS5 dialer.
func NewDialer ¶
NewDialer returns a new Dialer that dials through the provided proxy server's network and address.
func (*Dialer) DialContext ¶
DialContext connects to the provided address on the provided network.
type Server ¶
type Server struct { // Authentication is proxy authentication Authentication Authentication // ProxyDial specifies the optional proxyDial function for // establishing the transport connection. ProxyDial func(ctx context.Context, network string, address string) (net.Conn, error) // ProxyListen specifies the optional proxyListen function for // establishing the transport connection. ProxyListen func(context.Context, string, string) (net.Listener, error) // ProxyListenPacket specifies the optional proxyListenPacket function for // establishing the transport connection. ProxyListenPacket func(ctx context.Context, network string, address string) (net.PacketConn, error) // PacketForwardAddress specifies the packet forwarding address PacketForwardAddress func(ctx context.Context, destinationAddr string, packet net.PacketConn, conn net.Conn) (net.IP, int, error) // Logger error log Logger Logger // Context is default context Context context.Context // BytesPool getting and returning temporary bytes for use by io.CopyBuffer BytesPool BytesPool }
Server is accepting connections and handling the details of the SOCKS5 protocol
func (*Server) ListenAndServe ¶
ListenAndServe is used to create a listener and serve on it
type SimpleServer ¶ added in v0.2.3
type SimpleServer struct { Server Listener net.Listener Network string Address string Username string Password string }
SimpleServer is a simplified server, which can be configured as easily as client.
func NewSimpleServer ¶ added in v0.2.3
func NewSimpleServer(addr string) (*SimpleServer, error)
NewServer creates a new NewSimpleServer
func (*SimpleServer) Close ¶ added in v0.2.3
func (s *SimpleServer) Close() error
Close closes the listener
func (*SimpleServer) ProxyURL ¶ added in v0.2.3
func (s *SimpleServer) ProxyURL() string
ProxyURL returns the URL of the proxy
type UDPConn ¶ added in v0.2.1
type UDPConn struct { net.PacketConn // contains filtered or unexported fields }
func NewUDPConn ¶ added in v0.2.1
func (*UDPConn) ReadFromUDP ¶ added in v0.5.0
ReadFromUDP implements the net.UDPConn ReadFromUDP method.
func (*UDPConn) ReadFromUDPAddrPort ¶ added in v0.5.0
ReadFromUDPAddrPort implements the net.UDPConn ReadFromUDPAddrPort method.
func (*UDPConn) ReadMsgUDP ¶ added in v0.5.0
ReadMsgUDP implements the net.UDPConn ReadMsgUDP method.
func (*UDPConn) ReadMsgUDPAddrPort ¶ added in v0.5.0
func (c *UDPConn) ReadMsgUDPAddrPort(b, oob []byte) (n, oobn, flags int, addr netip.AddrPort, err error)
ReadMsgUDPAddrPort implements the net.UDPConn ReadMsgUDPAddrPort method.
func (*UDPConn) RemoteAddr ¶ added in v0.4.0
RemoteAddr implements the net.Conn RemoteAddr method.
func (*UDPConn) SetDeadline ¶ added in v0.5.0
SetDeadline implements the Conn SetDeadline method.
func (*UDPConn) SetReadBuffer ¶ added in v0.5.0
SetReadBuffer implements the net.UDPConn SetReadBuffer method.
func (*UDPConn) SetReadDeadline ¶ added in v0.5.0
SetReadDeadline implements the Conn SetReadDeadline method.
func (*UDPConn) SetWriteBuffer ¶ added in v0.5.0
SetWriteBuffer implements the net.UDPConn SetWriteBuffer method.
func (*UDPConn) SetWriteDeadline ¶ added in v0.5.0
SetWriteDeadline implements the Conn SetWriteDeadline method.
func (*UDPConn) WriteMsgUDP ¶ added in v0.5.0
WriteMsgUDP implements the net.UDPConn WriteMsgUDP method.
func (*UDPConn) WriteMsgUDPAddrPort ¶ added in v0.5.0
WriteMsgUDPAddrPort implements the net.UDPConn WriteMsgUDPAddrPort method.
func (*UDPConn) WriteToUDP ¶ added in v0.5.0
WriteToUDP implements the net.UDPConn WriteToUDP method.