mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 17:40:26 +00:00
Fix #539
This commit is contained in:
parent
f4e326f5dd
commit
ae0b2672ff
@ -249,7 +249,7 @@ func (t *tcp) call(saddr string, options interface{}, sintf string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.handler(conn, false, dialerdst.String())
|
t.handler(conn, false, saddr)
|
||||||
} else {
|
} else {
|
||||||
dst, err := net.ResolveTCPAddr("tcp", saddr)
|
dst, err := net.ResolveTCPAddr("tcp", saddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -322,18 +322,19 @@ func (t *tcp) handler(sock net.Conn, incoming bool, options interface{}) {
|
|||||||
t.setExtraOptions(sock)
|
t.setExtraOptions(sock)
|
||||||
stream := stream{}
|
stream := stream{}
|
||||||
stream.init(sock)
|
stream.init(sock)
|
||||||
local, _, _ := net.SplitHostPort(sock.LocalAddr().String())
|
var name, proto, local, remote string
|
||||||
remote, _, _ := net.SplitHostPort(sock.RemoteAddr().String())
|
|
||||||
force := net.ParseIP(strings.Split(remote, "%")[0]).IsLinkLocalUnicast()
|
|
||||||
var name string
|
|
||||||
var proto string
|
|
||||||
if socksaddr, issocks := options.(string); issocks {
|
if socksaddr, issocks := options.(string); issocks {
|
||||||
name = "socks://" + socksaddr + "/" + sock.RemoteAddr().String()
|
name = "socks://" + sock.RemoteAddr().String() + "/" + socksaddr
|
||||||
proto = "socks"
|
proto = "socks"
|
||||||
|
local, _, _ = net.SplitHostPort(sock.LocalAddr().String())
|
||||||
|
remote, _, _ = net.SplitHostPort(socksaddr)
|
||||||
} else {
|
} else {
|
||||||
name = "tcp://" + sock.RemoteAddr().String()
|
name = "tcp://" + sock.RemoteAddr().String()
|
||||||
proto = "tcp"
|
proto = "tcp"
|
||||||
|
local, _, _ = net.SplitHostPort(sock.LocalAddr().String())
|
||||||
|
remote, _, _ = net.SplitHostPort(sock.RemoteAddr().String())
|
||||||
}
|
}
|
||||||
|
force := net.ParseIP(strings.Split(remote, "%")[0]).IsLinkLocalUnicast()
|
||||||
link, err := t.link.core.link.create(&stream, name, proto, local, remote, incoming, force)
|
link, err := t.link.core.link.create(&stream, name, proto, local, remote, incoming, force)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.link.core.log.Println(err)
|
t.link.core.log.Println(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user