Documentation
¶
Index ¶
- Constants
- func ClientAuthAnonymous(conn *SocksConn) (err error)
- func ConnMonitor(c net.Conn, quit chan bool)
- func CopyLoopTimeout(c1 net.Conn, c2 net.Conn, timeout time.Duration)
- func Htons(data uint16) (ret [2]byte)
- func LegalClientAddr(clientAssociate *net.UDPAddr, addr *net.UDPAddr) bool
- func NetAddrToSocksAddr(addr interface{}) (hostType byte, host string, port uint16)
- func Ntohs(data [2]byte) uint16
- func PackUDPRequest(udpReq *UDPRequest) []byte
- func ParseHost(host string) (byte, string)
- func ReplyGeneralFailure(w io.Writer, req *SocksRequest) (n int, err error)
- func SockAddrString(host string, port uint16) string
- func SocksAddrToNetAddr(nw, host string, port uint16) net.Addr
- func UDPReader(u *net.UDPConn, ch chan<- *UDPPacket, quit chan bool)
- func WriteSocksReply(w io.Writer, reply *SocksReply) (n int, err error)
- func WriteSocksRequest(w io.Writer, req *SocksRequest) (n int, err error)
- type AnonymousClientAuthenticator
- type AnonymousServerAuthenticator
- type BasicSocksHandler
- func (h *BasicSocksHandler) HandleCmdConnect(req *SocksRequest, conn *SocksConn)
- func (h *BasicSocksHandler) HandleCmdUDPAssociate(req *SocksRequest, conn *SocksConn)
- func (h *BasicSocksHandler) Quit()
- func (h *BasicSocksHandler) ServeSocks(conn *SocksConn)
- func (h *BasicSocksHandler) UDPAssociateFirstPacket(req *SocksRequest, conn *SocksConn) (*net.UDPConn, *net.UDPAddr, *UDPRequest, *net.UDPAddr, error)
- func (h *BasicSocksHandler) UDPAssociateForwarding(conn *SocksConn, clientBind *net.UDPConn, clientAssociate *net.UDPAddr, ...)
- type ClientAuthenticator
- type Handler
- type HttpAuthenticator
- type Server
- type ServerAuthenticator
- type SocksConn
- type SocksDialer
- type SocksReply
- type SocksRequest
- type TlsAuthenticator
- type UDPPacket
- type UDPRequest
- type UserNamePasswordClientAuthenticator
Constants ¶
View Source
const ( SocksVersion = 0x05 SocksReserved = 0x00 SocksNoAuthentication = 0x00 SocksAuthMethodUsernamePassword = 0x02 SocksNoAcceptableMethods = 0xFF SocksIPv4Host = 0x01 SocksIPv6Host = 0x04 SocksDomainHost = 0x03 SocksCmdConnect = 0x01 SocksCmdBind = 0x02 SocksCmdUDPAssociate = 0x03 SocksSucceeded = 0x00 SocksGeneralFailure = 0x01 SocksNoFragment = 0x00 )
View Source
const (
DefaultPort = 1080
)
Variables ¶
This section is empty.
Functions ¶
func ClientAuthAnonymous ¶
func ConnMonitor ¶
func NetAddrToSocksAddr ¶
func PackUDPRequest ¶
func PackUDPRequest(udpReq *UDPRequest) []byte
func ReplyGeneralFailure ¶
func ReplyGeneralFailure(w io.Writer, req *SocksRequest) (n int, err error)
func SockAddrString ¶
func WriteSocksReply ¶
func WriteSocksReply(w io.Writer, reply *SocksReply) (n int, err error)
func WriteSocksRequest ¶
func WriteSocksRequest(w io.Writer, req *SocksRequest) (n int, err error)
Types ¶
type AnonymousClientAuthenticator ¶
type AnonymousClientAuthenticator struct{}
func (*AnonymousClientAuthenticator) ClientAuthenticate ¶
func (a *AnonymousClientAuthenticator) ClientAuthenticate(conn *SocksConn) (err error)
type AnonymousServerAuthenticator ¶
type AnonymousServerAuthenticator struct{}
func (*AnonymousServerAuthenticator) ServerAuthenticate ¶
func (a *AnonymousServerAuthenticator) ServerAuthenticate(conn *SocksConn) (err error)
type BasicSocksHandler ¶
type BasicSocksHandler struct{}
func (*BasicSocksHandler) HandleCmdConnect ¶
func (h *BasicSocksHandler) HandleCmdConnect(req *SocksRequest, conn *SocksConn)
func (*BasicSocksHandler) HandleCmdUDPAssociate ¶
func (h *BasicSocksHandler) HandleCmdUDPAssociate(req *SocksRequest, conn *SocksConn)
func (*BasicSocksHandler) Quit ¶
func (h *BasicSocksHandler) Quit()
func (*BasicSocksHandler) ServeSocks ¶
func (h *BasicSocksHandler) ServeSocks(conn *SocksConn)
func (*BasicSocksHandler) UDPAssociateFirstPacket ¶
func (h *BasicSocksHandler) UDPAssociateFirstPacket(req *SocksRequest, conn *SocksConn) (*net.UDPConn, *net.UDPAddr, *UDPRequest, *net.UDPAddr, error)
func (*BasicSocksHandler) UDPAssociateForwarding ¶
func (h *BasicSocksHandler) UDPAssociateForwarding(conn *SocksConn, clientBind *net.UDPConn, clientAssociate *net.UDPAddr, firstPkt *UDPRequest, clientAddr *net.UDPAddr)
type ClientAuthenticator ¶
type HttpAuthenticator ¶
type HttpAuthenticator struct { }
func (*HttpAuthenticator) ClientAuthenticate ¶
func (a *HttpAuthenticator) ClientAuthenticate(conn *SocksConn) (err error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ChangeAuth ¶
func (svr *Server) ChangeAuth(auth ServerAuthenticator)
ChangeAuth safely changes authenticator when server is running
func (*Server) ChangeHandler ¶
func (*Server) GetTimeout ¶
func (*Server) ListenAndServe ¶
type ServerAuthenticator ¶
type SocksDialer ¶
type SocksDialer struct { Timeout time.Duration Auth ClientAuthenticator }
type SocksReply ¶
func ClientRequest ¶
func ClientRequest(conn *SocksConn, req *SocksRequest) (reply *SocksReply, err error)
func ReadSocksReply ¶
func ReadSocksReply(r io.Reader) (reply *SocksReply, err error)
type SocksRequest ¶
func ReadSocksRequest ¶
func ReadSocksRequest(r io.Reader) (req *SocksRequest, err error)
type TlsAuthenticator ¶
type TlsAuthenticator struct { }
func (*TlsAuthenticator) ClientAuthenticate ¶
func (a *TlsAuthenticator) ClientAuthenticate(conn *SocksConn) (err error)
type UDPRequest ¶
func ParseUDPRequest ¶
func ParseUDPRequest(data []byte) (udpReq *UDPRequest, err error)
type UserNamePasswordClientAuthenticator ¶
func (*UserNamePasswordClientAuthenticator) ClientAuthenticate ¶
func (a *UserNamePasswordClientAuthenticator) ClientAuthenticate(conn *SocksConn) (err error)
Click to show internal directories.
Click to hide internal directories.