Load WgPort from config file and exchange via signal (#449)

Added additional common blacklisted interfaces

Updated the signal protocol to pass the peer port and netbird version

Co-authored-by: braginini <bangvalo@gmail.com>
This commit is contained in:
Maycon Santos
2022-09-02 19:33:35 +02:00
committed by GitHub
parent f1c00ae543
commit 4e5ee70b3d
10 changed files with 171 additions and 77 deletions

View File

@ -2,6 +2,7 @@ package client
import (
"fmt"
"github.com/netbirdio/netbird/client/system"
"github.com/netbirdio/netbird/signal/proto"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"io"
@ -41,13 +42,15 @@ func UnMarshalCredential(msg *proto.Message) (*Credential, error) {
}
// MarshalCredential marsharl a Credential instance and returns a Message object
func MarshalCredential(myKey wgtypes.Key, remoteKey wgtypes.Key, credential *Credential, t proto.Body_Type) (*proto.Message, error) {
func MarshalCredential(myKey wgtypes.Key, myPort int, remoteKey wgtypes.Key, credential *Credential, t proto.Body_Type) (*proto.Message, error) {
return &proto.Message{
Key: myKey.PublicKey().String(),
RemoteKey: remoteKey.String(),
Body: &proto.Body{
Type: t,
Payload: fmt.Sprintf("%s:%s", credential.UFrag, credential.Pwd),
Type: t,
Payload: fmt.Sprintf("%s:%s", credential.UFrag, credential.Pwd),
WgListenPort: uint32(myPort),
NetBirdVersion: system.NetbirdVersion(),
},
}, nil
}