diff options
Diffstat (limited to 'vendor/github.com/pion/turn/v2/internal/server/stun.go')
-rw-r--r-- | vendor/github.com/pion/turn/v2/internal/server/stun.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/github.com/pion/turn/v2/internal/server/stun.go b/vendor/github.com/pion/turn/v2/internal/server/stun.go new file mode 100644 index 0000000..673e99f --- /dev/null +++ b/vendor/github.com/pion/turn/v2/internal/server/stun.go @@ -0,0 +1,22 @@ +package server + +import ( + "github.com/pion/stun" + "github.com/pion/turn/v2/internal/ipnet" +) + +func handleBindingRequest(r Request, m *stun.Message) error { + r.Log.Debugf("received BindingRequest from %s", r.SrcAddr.String()) + + ip, port, err := ipnet.AddrIPPort(r.SrcAddr) + if err != nil { + return err + } + + attrs := buildMsg(m.TransactionID, stun.BindingSuccess, &stun.XORMappedAddress{ + IP: ip, + Port: port, + }, stun.Fingerprint) + + return buildAndSend(r.Conn, r.SrcAddr, attrs...) +} |