-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/discover #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat/discover #26
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #26 +/- ##
=======================================
Coverage ? 84.60%
=======================================
Files ? 12
Lines ? 1065
Branches ? 0
=======================================
Hits ? 901
Misses ? 131
Partials ? 33
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f77ad6f to
86b0df5
Compare
|
@xinze-zheng This is waiting for your ice PR right? I think we'll be able to finally migrate ice to options tomorrow. |
| func parse(msg *stun.Message, log *slog.Logger) (ret struct { | ||
| xorAddr *stun.XORMappedAddress | ||
| otherAddr *stun.OtherAddress | ||
| respOrigin *stun.ResponseOrigin | ||
| mappedAddr *stun.MappedAddress | ||
| software *stun.Software | ||
| }, | ||
| ) { | ||
| ret.mappedAddr = &stun.MappedAddress{} | ||
| ret.xorAddr = &stun.XORMappedAddress{} | ||
| ret.respOrigin = &stun.ResponseOrigin{} | ||
| ret.otherAddr = &stun.OtherAddress{} | ||
| ret.software = &stun.Software{} | ||
| if ret.xorAddr.GetFrom(msg) != nil { | ||
| ret.xorAddr = nil | ||
| } | ||
| if ret.otherAddr.GetFrom(msg) != nil { | ||
| ret.otherAddr = nil | ||
| } | ||
| if ret.respOrigin.GetFrom(msg) != nil { | ||
| ret.respOrigin = nil | ||
| } | ||
| if ret.mappedAddr.GetFrom(msg) != nil { | ||
| ret.mappedAddr = nil | ||
| } | ||
| if ret.software.GetFrom(msg) != nil { | ||
| ret.software = nil | ||
| } | ||
| for _, attr := range msg.Attributes { | ||
| switch attr.Type { | ||
| case | ||
| stun.AttrXORMappedAddress, | ||
| stun.AttrOtherAddress, | ||
| stun.AttrResponseOrigin, | ||
| stun.AttrMappedAddress, | ||
| stun.AttrSoftware: | ||
| break //nolint:staticcheck | ||
| default: | ||
| log.Debug(fmt.Sprintf("\t%v (l=%v)", attr, attr.Length)) | ||
| } | ||
| } | ||
|
|
||
| return ret | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should just use pion/stun here, what do you think?
Description
Logic for nat behavior discovery (RFC5780). Adapted and modified from pion/stun.
Reference issue
#22