mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 17:35:40 +08:00
socks4: fix compile problem
This commit is contained in:
parent
f14c4c7797
commit
fa3a7da859
@ -11,11 +11,23 @@ import (
|
|||||||
|
|
||||||
// Dialer is used to create connection.
|
// Dialer is used to create connection.
|
||||||
type Dialer interface {
|
type Dialer interface {
|
||||||
|
TCPDialer
|
||||||
|
UDPDialer
|
||||||
|
}
|
||||||
|
|
||||||
|
// TCPDialer is used to create connection.
|
||||||
|
type TCPDialer interface {
|
||||||
// Addr is the dialer's addr
|
// Addr is the dialer's addr
|
||||||
Addr() string
|
Addr() string
|
||||||
|
|
||||||
// Dial connects to the given address
|
// Dial connects to the given address
|
||||||
Dial(network, addr string) (c net.Conn, err error)
|
Dial(network, addr string) (c net.Conn, err error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UDPDialer is used to create connection.
|
||||||
|
type UDPDialer interface {
|
||||||
|
// Addr is the dialer's addr
|
||||||
|
Addr() string
|
||||||
|
|
||||||
// DialUDP connects to the given address
|
// DialUDP connects to the given address
|
||||||
DialUDP(network, addr string) (pc net.PacketConn, writeTo net.Addr, err error)
|
DialUDP(network, addr string) (pc net.PacketConn, writeTo net.Addr, err error)
|
||||||
|
@ -62,9 +62,6 @@ func (s *SOCKS4) Addr() string {
|
|||||||
return s.addr
|
return s.addr
|
||||||
}
|
}
|
||||||
|
|
||||||
// NextDialer returns the next dialer.
|
|
||||||
func (s *SOCKS4) NextDialer(dstAddr string) proxy.Dialer { return s.dialer.NextDialer(dstAddr) }
|
|
||||||
|
|
||||||
// Dial connects to the address addr on the network net via the SOCKS4 proxy.
|
// Dial connects to the address addr on the network net via the SOCKS4 proxy.
|
||||||
func (s *SOCKS4) Dial(network, addr string) (net.Conn, error) {
|
func (s *SOCKS4) Dial(network, addr string) (net.Conn, error) {
|
||||||
switch network {
|
switch network {
|
||||||
|
@ -60,7 +60,7 @@ func (pc *PktConn) ReadFrom(b []byte) (int, net.Addr, error) {
|
|||||||
return n, nil, err
|
return n, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadFrom implements the necessary function of net.PacketConn.
|
// WriteTo implements the necessary function of net.PacketConn.
|
||||||
func (pc *PktConn) WriteTo(b []byte, addr net.Addr) (int, error) {
|
func (pc *PktConn) WriteTo(b []byte, addr net.Addr) (int, error) {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
buf.Write(pc.tgtAddr)
|
buf.Write(pc.tgtAddr)
|
||||||
|
Loading…
Reference in New Issue
Block a user