mirror of
https://github.com/netbirdio/netbird.git
synced 2025-08-08 23:05:28 +02:00
Exchange proxy mode via signal (#727)
Before defining if we will use direct or proxy connection we will exchange a message with the other peer if the modes match we keep the decision from the shouldUseProxy function otherwise we skip using direct connection. Added a feature support message to the signal protocol
This commit is contained in:
@ -19,6 +19,16 @@ type Status string
|
||||
const StreamConnected Status = "Connected"
|
||||
const StreamDisconnected Status = "Disconnected"
|
||||
|
||||
const (
|
||||
// DirectCheck indicates support to direct mode checks
|
||||
DirectCheck uint32 = 1
|
||||
)
|
||||
|
||||
// FeaturesSupport register protocol supported features
|
||||
type FeaturesSupport struct {
|
||||
DirectCheck bool
|
||||
}
|
||||
|
||||
type Client interface {
|
||||
io.Closer
|
||||
StreamConnected() bool
|
||||
@ -62,3 +72,15 @@ type Credential struct {
|
||||
UFrag string
|
||||
Pwd string
|
||||
}
|
||||
|
||||
// ParseFeaturesSupported parses a slice of supported features into FeaturesSupport
|
||||
func ParseFeaturesSupported(featuresMessage []uint32) FeaturesSupport {
|
||||
var protoSupport FeaturesSupport
|
||||
for _, feature := range featuresMessage {
|
||||
if feature == DirectCheck {
|
||||
protoSupport.DirectCheck = true
|
||||
return protoSupport
|
||||
}
|
||||
}
|
||||
return protoSupport
|
||||
}
|
||||
|
Reference in New Issue
Block a user