Improve: using native http request
This commit is contained in:
@ -2,17 +2,19 @@ package constant
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net"
|
||||
)
|
||||
|
||||
type ProxyAdapter interface {
|
||||
Writer() io.Writer
|
||||
Reader() io.Reader
|
||||
ReadWriter() io.ReadWriter
|
||||
Conn() net.Conn
|
||||
Close()
|
||||
}
|
||||
|
||||
type ServerAdapter interface {
|
||||
Addr() *Addr
|
||||
ProxyAdapter
|
||||
Connect(ProxyAdapter)
|
||||
Close()
|
||||
}
|
||||
|
||||
type Proxy interface {
|
||||
|
@ -9,10 +9,23 @@ const (
|
||||
AtypIPv4 = 1
|
||||
AtypDomainName = 3
|
||||
AtypIPv6 = 4
|
||||
|
||||
TCP = iota
|
||||
UDP
|
||||
)
|
||||
|
||||
type NetWork int
|
||||
|
||||
func (n *NetWork) String() string {
|
||||
if *n == TCP {
|
||||
return "tcp"
|
||||
}
|
||||
return "udp"
|
||||
}
|
||||
|
||||
// Addr is used to store connection address
|
||||
type Addr struct {
|
||||
NetWork NetWork
|
||||
AddrType int
|
||||
Host string
|
||||
IP *net.IP
|
||||
|
Reference in New Issue
Block a user