mirror of https://github.com/cbeuw/Cloak
Fix duplicate UDP binding
This commit is contained in:
parent
5984fde09f
commit
128f653ea4
|
|
@ -10,9 +10,9 @@ import (
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RouteUDP(acceptFunc func() (*net.UDPConn, error), streamTimeout time.Duration, newSeshFunc func() *mux.Session) {
|
func RouteUDP(bindFunc func() (*net.UDPConn, error), streamTimeout time.Duration, newSeshFunc func() *mux.Session) {
|
||||||
var sesh *mux.Session
|
var sesh *mux.Session
|
||||||
localConn, err := acceptFunc()
|
localConn, err := bindFunc()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -24,10 +24,6 @@ func RouteUDP(acceptFunc func() (*net.UDPConn, error), streamTimeout time.Durati
|
||||||
i, addr, err := localConn.ReadFrom(data)
|
i, addr, err := localConn.ReadFrom(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Failed to read first packet from proxy client: %v", err)
|
log.Errorf("Failed to read first packet from proxy client: %v", err)
|
||||||
localConn, err = acceptFunc()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue