mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-15 23:06:38 +00:00
Remove unused variables from peer conn (#2074)
Remove unused variables from peer conn
This commit is contained in:
@@ -25,11 +25,6 @@ const (
|
||||
DirectCheck uint32 = 1
|
||||
)
|
||||
|
||||
// FeaturesSupport register protocol supported features
|
||||
type FeaturesSupport struct {
|
||||
DirectCheck bool
|
||||
}
|
||||
|
||||
type Client interface {
|
||||
io.Closer
|
||||
StreamConnected() bool
|
||||
@@ -79,15 +74,3 @@ 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
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"net"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@@ -168,41 +167,6 @@ var _ = Describe("GrpcClient", func() {
|
||||
|
||||
})
|
||||
|
||||
func TestParseFeaturesSupported(t *testing.T) {
|
||||
expectedOnEmptyOrUnsupported := FeaturesSupport{DirectCheck: false}
|
||||
expectedWithDirectCheck := FeaturesSupport{DirectCheck: true}
|
||||
testCases := []struct {
|
||||
name string
|
||||
input []uint32
|
||||
expected FeaturesSupport
|
||||
}{
|
||||
{
|
||||
name: "Should Return DirectCheck Supported",
|
||||
input: []uint32{DirectCheck},
|
||||
expected: expectedWithDirectCheck,
|
||||
},
|
||||
{
|
||||
name: "Should Return DirectCheck Unsupported When Nil",
|
||||
input: nil,
|
||||
expected: expectedOnEmptyOrUnsupported,
|
||||
},
|
||||
{
|
||||
name: "Should Return DirectCheck Unsupported When Not Known Feature",
|
||||
input: []uint32{9999},
|
||||
expected: expectedOnEmptyOrUnsupported,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
result := ParseFeaturesSupported(testCase.input)
|
||||
if result.DirectCheck != testCase.expected.DirectCheck {
|
||||
t.Errorf("Direct check feature should match: Expected: %t, Got: %t", testCase.expected.DirectCheck, result.DirectCheck)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func createSignalClient(addr string, key wgtypes.Key) *GrpcClient {
|
||||
var sigTLSEnabled = false
|
||||
client, err := NewClient(context.Background(), addr, key, sigTLSEnabled)
|
||||
|
||||
Reference in New Issue
Block a user