mirror of
https://github.com/fatedier/frp.git
synced 2025-12-11 10:28:16 +00:00
feat(nathole): use serverUDPPort in nathole discovery when available (#3382)
This commit is contained in:
@@ -16,8 +16,11 @@ package nathole
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net"
|
||||
"strconv"
|
||||
|
||||
"github.com/fatedier/golib/crypto"
|
||||
"github.com/pion/stun"
|
||||
|
||||
"github.com/fatedier/frp/pkg/msg"
|
||||
)
|
||||
@@ -46,3 +49,17 @@ func DecodeMessageInto(data, key []byte, m msg.Message) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ChangedAddress struct {
|
||||
IP net.IP
|
||||
Port int
|
||||
}
|
||||
|
||||
func (s *ChangedAddress) GetFrom(m *stun.Message) error {
|
||||
a := (*stun.MappedAddress)(s)
|
||||
return a.GetFromAs(m, stun.AttrChangedAddress)
|
||||
}
|
||||
|
||||
func (s *ChangedAddress) String() string {
|
||||
return net.JoinHostPort(s.IP.String(), strconv.Itoa(s.Port))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user