fix circle import

This commit is contained in:
Zoltán Papp 2024-06-17 18:02:52 +02:00
parent e407fe02c5
commit deb8203f06
5 changed files with 11 additions and 15 deletions

View File

@ -97,7 +97,7 @@ type EngineConfig struct {
type Engine struct {
// signal is a Signal Service client
signal signal.Client
signaler *Signaler
signaler *peer.Signaler
// mgmClient is a Management Service client
mgmClient mgm.Client
// peerConns is a map that holds all the peers that are known to this peer

View File

@ -12,7 +12,6 @@ import (
log "github.com/sirupsen/logrus"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/netbirdio/netbird/client/internal"
"github.com/netbirdio/netbird/client/internal/stdnet"
"github.com/netbirdio/netbird/client/internal/wgproxy"
"github.com/netbirdio/netbird/iface"
@ -73,7 +72,7 @@ type Conn struct {
statusRecorder *Status
wgProxyFactory *wgproxy.Factory
wgProxy wgproxy.Proxy
signaler *internal.Signaler
signaler *Signaler
allowedIPsIP string
handshaker *Handshaker
closeCh chan struct{}
@ -95,7 +94,7 @@ type Conn struct {
// NewConn creates a new not opened Conn to the remote peer.
// To establish a connection run Conn.Open
func NewConn(engineCtx context.Context, config ConnConfig, statusRecorder *Status, wgProxyFactory *wgproxy.Factory, signaler *internal.Signaler, iFaceDiscover stdnet.ExternalIFaceDiscover, relayManager *relayClient.Manager) (*Conn, error) {
func NewConn(engineCtx context.Context, config ConnConfig, statusRecorder *Status, wgProxyFactory *wgproxy.Factory, signaler *Signaler, iFaceDiscover stdnet.ExternalIFaceDiscover, relayManager *relayClient.Manager) (*Conn, error) {
_, allowedIPsIP, err := net.ParseCIDR(config.WgConfig.AllowedIps)
if err != nil {
log.Errorf("failed to parse allowedIPS: %v", err)

View File

@ -15,7 +15,6 @@ import (
"github.com/pion/stun/v2"
log "github.com/sirupsen/logrus"
"github.com/netbirdio/netbird/client/internal"
"github.com/netbirdio/netbird/client/internal/stdnet"
"github.com/netbirdio/netbird/iface"
"github.com/netbirdio/netbird/iface/bind"
@ -64,7 +63,7 @@ type ConnectorICE struct {
log *log.Entry
config ConnConfig
configICE ICEConfig
signaler *internal.Signaler
signaler *Signaler
iFaceDiscover stdnet.ExternalIFaceDiscover
statusRecorder *Status
onICEConnReady OnICEConnReadyCallback
@ -79,7 +78,7 @@ type ConnectorICE struct {
sentExtraSrflx bool
}
func NewConnectorICE(ctx context.Context, log *log.Entry, config ConnConfig, configICE ICEConfig, signaler *internal.Signaler, ifaceDiscover stdnet.ExternalIFaceDiscover, statusRecorder *Status, onICEConnReady OnICEConnReadyCallback, doHandshakeFn DoHandshake) *ConnectorICE {
func NewConnectorICE(ctx context.Context, log *log.Entry, config ConnConfig, configICE ICEConfig, signaler *Signaler, ifaceDiscover stdnet.ExternalIFaceDiscover, statusRecorder *Status, onICEConnReady OnICEConnReadyCallback, doHandshakeFn DoHandshake) *ConnectorICE {
cice := &ConnectorICE{
ctx: ctx,
log: log,

View File

@ -9,7 +9,6 @@ import (
log "github.com/sirupsen/logrus"
"golang.zx2c4.com/wireguard/conn"
"github.com/netbirdio/netbird/client/internal"
"github.com/netbirdio/netbird/version"
)
@ -60,7 +59,7 @@ type Handshaker struct {
mu sync.Mutex
ctx context.Context
config ConnConfig
signaler *internal.Signaler
signaler *Signaler
// remoteOffersCh is a channel used to wait for remote credentials to proceed with the connection
remoteOffersCh chan OfferAnswer
@ -71,7 +70,7 @@ type Handshaker struct {
remoteOfferAnswerCreated time.Time
}
func NewHandshaker(ctx context.Context, config ConnConfig, signaler *internal.Signaler) *Handshaker {
func NewHandshaker(ctx context.Context, config ConnConfig, signaler *Signaler) *Handshaker {
return &Handshaker{
ctx: ctx,
config: config,

View File

@ -1,10 +1,9 @@
package internal
package peer
import (
"github.com/pion/ice/v3"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"github.com/netbirdio/netbird/client/internal/peer"
signal "github.com/netbirdio/netbird/signal/client"
sProto "github.com/netbirdio/netbird/signal/proto"
)
@ -21,11 +20,11 @@ func NewSignaler(signal signal.Client, wgPrivateKey wgtypes.Key) *Signaler {
}
}
func (s *Signaler) SignalOffer(offer peer.OfferAnswer, remoteKey string) error {
func (s *Signaler) SignalOffer(offer OfferAnswer, remoteKey string) error {
return s.signalOfferAnswer(offer, remoteKey, sProto.Body_OFFER)
}
func (s *Signaler) SignalAnswer(offer peer.OfferAnswer, remoteKey string) error {
func (s *Signaler) SignalAnswer(offer OfferAnswer, remoteKey string) error {
return s.signalOfferAnswer(offer, remoteKey, sProto.Body_ANSWER)
}
@ -45,7 +44,7 @@ func (s *Signaler) Ready() bool {
}
// SignalOfferAnswer signals either an offer or an answer to remote peer
func (s *Signaler) signalOfferAnswer(offerAnswer peer.OfferAnswer, remoteKey string, bodyType sProto.Body_Type) error {
func (s *Signaler) signalOfferAnswer(offerAnswer OfferAnswer, remoteKey string, bodyType sProto.Body_Type) error {
msg, err := signal.MarshalCredential(
s.wgPrivateKey,
offerAnswer.WgListenPort,