mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-20 15:31:30 +02:00
Remove orphaned relay address package and legacy HelloResponse handling
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
// Deprecated: This package is deprecated and will be removed in a future release.
|
||||
package address
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/gob"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Address struct {
|
||||
URL string
|
||||
}
|
||||
|
||||
func (addr *Address) Marshal() ([]byte, error) {
|
||||
var buf bytes.Buffer
|
||||
enc := gob.NewEncoder(&buf)
|
||||
if err := enc.Encode(addr); err != nil {
|
||||
return nil, fmt.Errorf("encode Address: %w", err)
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
@@ -14,9 +14,10 @@ const (
|
||||
CurrentProtocolVersion = 1
|
||||
|
||||
MsgTypeUnknown MsgType = 0
|
||||
// Deprecated: Use MsgTypeAuth instead.
|
||||
MsgTypeHello = 1
|
||||
// Deprecated: Use MsgTypeAuthResponse instead.
|
||||
// MsgTypeHello and MsgTypeHelloResponse are the removed legacy handshake
|
||||
// message types. They are retained only to reserve wire values 1 and 2 so
|
||||
// the values are never reused; the server rejects both.
|
||||
MsgTypeHello = 1
|
||||
MsgTypeHelloResponse = 2
|
||||
MsgTypeTransport = 3
|
||||
MsgTypeClose = 4
|
||||
@@ -130,7 +131,6 @@ func DetermineServerMessageType(msg []byte) (MsgType, error) {
|
||||
msgType := MsgType(msg[1])
|
||||
switch msgType {
|
||||
case
|
||||
MsgTypeHelloResponse,
|
||||
MsgTypeAuthResponse,
|
||||
MsgTypeTransport,
|
||||
MsgTypeClose,
|
||||
|
||||
@@ -5,8 +5,7 @@ import (
|
||||
)
|
||||
|
||||
func TestDetermineClientMessageTypeRejectsHello(t *testing.T) {
|
||||
// The deprecated Hello message (type 1) is no longer accepted by the
|
||||
// server, closing the pre-auth gob decode path (GHSA-v5w2-pqxj-6r94).
|
||||
// The reserved legacy Hello message (type 1) must be rejected by the server.
|
||||
msg := []byte{byte(CurrentProtocolVersion), byte(MsgTypeHello)}
|
||||
if _, err := DetermineClientMessageType(msg); err == nil {
|
||||
t.Fatalf("expected hello message type to be rejected")
|
||||
|
||||
Reference in New Issue
Block a user