Merge branch 'master' into dev
# Conflicts: # CHANGELOG
This commit is contained in:
@ -1,8 +1,10 @@
|
|||||||
proxy更新日志
|
proxy更新日志
|
||||||
v6.4
|
v6.4
|
||||||
1.http(s)代理增加了--jumper参数,可以穿透外部代理连接上级.
|
1.http(s)代理增加了--jumper参数,可以穿透外部代理连接上级.
|
||||||
2.sps代理增加了--jumper参数,可以穿透外部代理连接上级.
|
2.优化了socks5代理UDP功能可能存在的内存占用过多问题.
|
||||||
3.修复了--debug不能正常工作的问题.
|
3.优化了jumper,避免某些情况下不能正确返回错误的问题.
|
||||||
|
4.sps代理增加了--jumper参数,可以穿透外部代理连接上级.
|
||||||
|
5.修复了--debug不能正常工作的问题.
|
||||||
|
|
||||||
v6.3
|
v6.3
|
||||||
1.fixed #156
|
1.fixed #156
|
||||||
|
|||||||
@ -242,9 +242,9 @@ func (s *MuxClient) getParentConn() (conn net.Conn, err error) {
|
|||||||
conn = net.Conn(&_conn)
|
conn = net.Conn(&_conn)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
conf, err := utils.TlsConfig(s.cfg.CertBytes, s.cfg.KeyBytes, nil)
|
conf, e := utils.TlsConfig(s.cfg.CertBytes, s.cfg.KeyBytes, nil)
|
||||||
if err != nil {
|
if e != nil {
|
||||||
return nil, err
|
return nil, e
|
||||||
}
|
}
|
||||||
var _c net.Conn
|
var _c net.Conn
|
||||||
_c, err = s.jumper.Dial(*s.cfg.Parent, time.Millisecond*time.Duration(*s.cfg.Timeout))
|
_c, err = s.jumper.Dial(*s.cfg.Parent, time.Millisecond*time.Duration(*s.cfg.Timeout))
|
||||||
|
|||||||
@ -174,9 +174,9 @@ func (s *Socks) proxyUDP(inConn *net.Conn, serverConn *socks.ServerConn) {
|
|||||||
}
|
}
|
||||||
s.log.Printf("use proxy %v : udp %s", useProxy, serverConn.Target())
|
s.log.Printf("use proxy %v : udp %s", useProxy, serverConn.Target())
|
||||||
//relay
|
//relay
|
||||||
for {
|
|
||||||
buf := utils.LeakyBuffer.Get()
|
buf := utils.LeakyBuffer.Get()
|
||||||
defer utils.LeakyBuffer.Put(buf)
|
defer utils.LeakyBuffer.Put(buf)
|
||||||
|
for {
|
||||||
n, srcAddr, err := udpListener.ReadFromUDP(buf)
|
n, srcAddr, err := udpListener.ReadFromUDP(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.Printf("udp listener read fail, %s", err.Error())
|
s.log.Printf("udp listener read fail, %s", err.Error())
|
||||||
|
|||||||
@ -126,9 +126,9 @@ func (s *SPS) proxyUDP(inConn *net.Conn, serverConn *socks.ServerConn) {
|
|||||||
//s.log.Printf("parent udp address %s", client.UDPAddr)
|
//s.log.Printf("parent udp address %s", client.UDPAddr)
|
||||||
destAddr, _ = net.ResolveUDPAddr("udp", client.UDPAddr)
|
destAddr, _ = net.ResolveUDPAddr("udp", client.UDPAddr)
|
||||||
//relay
|
//relay
|
||||||
for {
|
|
||||||
buf := utils.LeakyBuffer.Get()
|
buf := utils.LeakyBuffer.Get()
|
||||||
defer utils.LeakyBuffer.Put(buf)
|
defer utils.LeakyBuffer.Put(buf)
|
||||||
|
for {
|
||||||
n, srcAddr, err := udpListener.ReadFromUDP(buf)
|
n, srcAddr, err := udpListener.ReadFromUDP(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.Printf("udp listener read fail, %s", err.Error())
|
s.log.Printf("udp listener read fail, %s", err.Error())
|
||||||
|
|||||||
@ -27,9 +27,9 @@ func (s *SPS) RunSSUDP(addr string) (err error) {
|
|||||||
s.log.Printf("udp local->out io copy crashed:\n%s\n%s", e, string(debug.Stack()))
|
s.log.Printf("udp local->out io copy crashed:\n%s\n%s", e, string(debug.Stack()))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
for {
|
|
||||||
buf := utils.LeakyBuffer.Get()
|
buf := utils.LeakyBuffer.Get()
|
||||||
defer utils.LeakyBuffer.Put(buf)
|
defer utils.LeakyBuffer.Put(buf)
|
||||||
|
for {
|
||||||
n, srcAddr, err := listener.ReadFrom(buf)
|
n, srcAddr, err := listener.ReadFrom(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.Printf("read from client error %s", err)
|
s.log.Printf("read from client error %s", err)
|
||||||
|
|||||||
@ -24,8 +24,9 @@ func (s socks5Dialer) Dial(network, addr string) (net.Conn, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func New(proxyURL string, timeout time.Duration) (j Jumper, err error) {
|
func New(proxyURL string, timeout time.Duration) (j Jumper, err error) {
|
||||||
u, err := url.Parse(proxyURL)
|
u, e := url.Parse(proxyURL)
|
||||||
if err != nil {
|
if e != nil {
|
||||||
|
err = e
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
j = Jumper{
|
j = Jumper{
|
||||||
@ -34,7 +35,7 @@ func New(proxyURL string, timeout time.Duration) (j Jumper, err error) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (j *Jumper) Dial(address string, timeout time.Duration) (conn net.Conn, err error) {
|
func (j *Jumper) Dial(address string, timeout time.Duration) (net.Conn, error) {
|
||||||
switch j.proxyURL.Scheme {
|
switch j.proxyURL.Scheme {
|
||||||
case "https":
|
case "https":
|
||||||
return j.dialHTTPS(address, timeout)
|
return j.dialHTTPS(address, timeout)
|
||||||
@ -70,10 +71,10 @@ func (j *Jumper) dialHTTPS(address string, timeout time.Duration) (conn net.Conn
|
|||||||
}
|
}
|
||||||
reply := make([]byte, 1024)
|
reply := make([]byte, 1024)
|
||||||
conn.SetDeadline(time.Now().Add(timeout))
|
conn.SetDeadline(time.Now().Add(timeout))
|
||||||
n, err := conn.Read(reply)
|
n, e := conn.Read(reply)
|
||||||
conn.SetDeadline(time.Time{})
|
conn.SetDeadline(time.Time{})
|
||||||
if err != nil {
|
if e != nil {
|
||||||
err = fmt.Errorf("error read reply from proxy: %s", err)
|
err = fmt.Errorf("error read reply from proxy: %s", e)
|
||||||
conn.Close()
|
conn.Close()
|
||||||
conn = nil
|
conn = nil
|
||||||
return
|
return
|
||||||
@ -94,9 +95,9 @@ func (j *Jumper) dialSOCKS5(address string, timeout time.Duration) (conn net.Con
|
|||||||
} else {
|
} else {
|
||||||
auth = nil
|
auth = nil
|
||||||
}
|
}
|
||||||
dialSocksProxy, err := proxy.SOCKS5("tcp", j.proxyURL.Host, auth, socks5Dialer{timeout: timeout})
|
dialSocksProxy, e := proxy.SOCKS5("tcp", j.proxyURL.Host, auth, socks5Dialer{timeout: timeout})
|
||||||
if err != nil {
|
if e != nil {
|
||||||
err = fmt.Errorf("error connecting to proxy: %s", err)
|
err = fmt.Errorf("error connecting to proxy: %s", e)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return dialSocksProxy.Dial("tcp", address)
|
return dialSocksProxy.Dial("tcp", address)
|
||||||
|
|||||||
Reference in New Issue
Block a user