Documentation
¶
Index ¶
- func NewRulePermitAll() socks5.RuleSet
- type Client
- type Logger
- type ReadWriterConnWrapper
- type RuleDenyLocalhost
- type Server
- func (s *Server) SendServerFailureReply(conn io.ReadWriter) error
- func (s *Server) ServeConn(ioConn io.ReadWriteCloser) error
- func (s *Server) ServeStreamConn(stream network.Stream) error
- func (s *Server) ServeStreamConnNoAuth(stream network.Stream) error
- func (s *Server) SetRules(rule socks5.RuleSet)
- type StreamConnWrapper
- type UpdatableRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRulePermitAll ¶
Types ¶
type ReadWriterConnWrapper ¶
type ReadWriterConnWrapper struct {
io.ReadWriteCloser
}
ReadWriterConnWrapper is used for socks5
func (ReadWriterConnWrapper) LocalAddr ¶
func (c ReadWriterConnWrapper) LocalAddr() net.Addr
func (ReadWriterConnWrapper) RemoteAddr ¶
func (c ReadWriterConnWrapper) RemoteAddr() net.Addr
func (ReadWriterConnWrapper) SetDeadline ¶
func (c ReadWriterConnWrapper) SetDeadline(time.Time) error
func (ReadWriterConnWrapper) SetReadDeadline ¶
func (c ReadWriterConnWrapper) SetReadDeadline(time.Time) error
func (ReadWriterConnWrapper) SetWriteDeadline ¶
func (c ReadWriterConnWrapper) SetWriteDeadline(time.Time) error
type RuleDenyLocalhost ¶
type RuleDenyLocalhost struct {
// contains filtered or unexported fields
}
func NewRuleDenyLocalhost ¶
func NewRuleDenyLocalhost() *RuleDenyLocalhost
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
NewServer constructs the SOCKS5 exit-node server. dialControl, when non-nil, is applied to every outbound connection the server opens to the real destination — it is the same socket-marking callback used for libp2p sockets (sockmark). This keeps SOCKS5 exit-node traffic going out the host's physical NIC, independent of whether this node is itself a VPN gateway client (whose 0.0.0.0/0-via-TUN default route would otherwise capture these sockets). Marking unconditionally is safe: when gateway mode is off there is no matching fwmark ip-rule, so the kernel ignores the mark — mirroring how libp2p sockets are marked at all times (see application.go). A nil dialControl yields a plain context-aware dialer.
TODO(socks5-udp): UDP ASSOCIATE is effectively unsupported today (we serve only libp2p streams via ServeConn; haxii's UDP relay starts only inside Serve(), and BindIP is a fake 127.0.0.1). If it is ever enabled, note that haxii creates its UDP sockets directly (net.ListenUDP / net.DialUDP in udp.go) — bypassing config.Dial and therefore this marking, on every platform. Those sockets would need their own dialControl-style hook, otherwise UDP relay traffic loops into the VPN gateway tunnel.
func (*Server) SendServerFailureReply ¶
func (s *Server) SendServerFailureReply(conn io.ReadWriter) error
func (*Server) ServeConn ¶
func (s *Server) ServeConn(ioConn io.ReadWriteCloser) error
ServeConn is only used in tests. TODO: refactor tests
func (*Server) ServeStreamConnNoAuth ¶ added in v0.17.0
type StreamConnWrapper ¶
StreamConnWrapper is used for socks5
func (StreamConnWrapper) Close ¶
func (c StreamConnWrapper) Close() error
func (StreamConnWrapper) LocalAddr ¶
func (c StreamConnWrapper) LocalAddr() net.Addr
func (StreamConnWrapper) RemoteAddr ¶
func (c StreamConnWrapper) RemoteAddr() net.Addr
type UpdatableRule ¶
type UpdatableRule struct {
// contains filtered or unexported fields
}
func NewUpdatableRule ¶
func NewUpdatableRule(rule socks5.RuleSet) *UpdatableRule
func (*UpdatableRule) SetRule ¶
func (r *UpdatableRule) SetRule(rule socks5.RuleSet)