mirror of
https://github.com/fatedier/frp.git
synced 2025-04-24 00:51:27 +00:00
Merge 5b3215018892350bc71e74b9bffb1cf1222f34d6 into 773169e0c44070facd652c4b8b3fe6e6ff4d78f3
This commit is contained in:
commit
9b77428000
@ -64,7 +64,7 @@ func (pxy *XTCPProxy) InWorkConn(conn net.Conn, startWorkConnMsg *msg.StartWorkC
|
|||||||
}
|
}
|
||||||
|
|
||||||
xl.Tracef("nathole prepare start")
|
xl.Tracef("nathole prepare start")
|
||||||
prepareResult, err := nathole.Prepare([]string{pxy.clientCfg.NatHoleSTUNServer})
|
prepareResult, err := nathole.Prepare([]string{pxy.clientCfg.NatHoleSTUNServer}, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
xl.Warnf("nathole prepare error: %v", err)
|
xl.Warnf("nathole prepare error: %v", err)
|
||||||
return
|
return
|
||||||
|
@ -275,7 +275,7 @@ func (sv *XTCPVisitor) makeNatHole() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
xl.Tracef("nathole prepare start")
|
xl.Tracef("nathole prepare start")
|
||||||
prepareResult, err := nathole.Prepare([]string{sv.clientCfg.NatHoleSTUNServer})
|
prepareResult, err := nathole.Prepare([]string{sv.clientCfg.NatHoleSTUNServer}, sv.cfg.UDPListen)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
xl.Warnf("nathole prepare error: %v", err)
|
xl.Warnf("nathole prepare error: %v", err)
|
||||||
return
|
return
|
||||||
|
@ -157,6 +157,11 @@ type XTCPVisitorConfig struct {
|
|||||||
MinRetryInterval int `json:"minRetryInterval,omitempty"`
|
MinRetryInterval int `json:"minRetryInterval,omitempty"`
|
||||||
FallbackTo string `json:"fallbackTo,omitempty"`
|
FallbackTo string `json:"fallbackTo,omitempty"`
|
||||||
FallbackTimeoutMs int `json:"fallbackTimeoutMs,omitempty"`
|
FallbackTimeoutMs int `json:"fallbackTimeoutMs,omitempty"`
|
||||||
|
|
||||||
|
// Specify the listen addr and port for the UDP NAT hole punching, the format is "addr:port" like "0.0.0.0:7000".
|
||||||
|
// It is useful when your router's NAT hole punching doesn't work well, so you can explicitly config a UDP port
|
||||||
|
// forwarding rule on the router to work around.
|
||||||
|
UDPListen string `json:"udpListen,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *XTCPVisitorConfig) Complete(g *ClientCommonConfig) {
|
func (c *XTCPVisitorConfig) Complete(g *ClientCommonConfig) {
|
||||||
|
@ -108,9 +108,9 @@ func PreCheck(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare is used to do some preparation work before penetration.
|
// Prepare is used to do some preparation work before penetration.
|
||||||
func Prepare(stunServers []string) (*PrepareResult, error) {
|
func Prepare(stunServers []string, udpListen string) (*PrepareResult, error) {
|
||||||
// discover for Nat type
|
// discover for Nat type
|
||||||
addrs, localAddr, err := Discover(stunServers, "")
|
addrs, localAddr, err := Discover(stunServers, udpListen)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("discover error: %v", err)
|
return nil, fmt.Errorf("discover error: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user