mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-27 12:46:39 +00:00
Compare commits
4 Commits
enable-udp
...
v0.36.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e836db1d1 | ||
|
|
c01874e9ce | ||
|
|
1b2517ea20 | ||
|
|
3e9f0d57ac |
@@ -105,7 +105,7 @@ func getOSNameAndVersion() (string, string) {
|
|||||||
|
|
||||||
split := strings.Split(dst[0].Caption, " ")
|
split := strings.Split(dst[0].Caption, " ")
|
||||||
|
|
||||||
if len(split) < 3 {
|
if len(split) <= 3 {
|
||||||
return "Windows", getBuildVersion()
|
return "Windows", getBuildVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1549,6 +1549,11 @@ func domainIsUpToDate(domain string, domainCategory string, claims jwtclaims.Aut
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (am *DefaultAccountManager) SyncAndMarkPeer(ctx context.Context, accountID string, peerPubKey string, meta nbpeer.PeerSystemMeta, realIP net.IP) (*nbpeer.Peer, *types.NetworkMap, []*posture.Checks, error) {
|
func (am *DefaultAccountManager) SyncAndMarkPeer(ctx context.Context, accountID string, peerPubKey string, meta nbpeer.PeerSystemMeta, realIP net.IP) (*nbpeer.Peer, *types.NetworkMap, []*posture.Checks, error) {
|
||||||
|
start := time.Now()
|
||||||
|
defer func() {
|
||||||
|
log.WithContext(ctx).Debugf("SyncAndMarkPeer: took %v", time.Since(start))
|
||||||
|
}()
|
||||||
|
|
||||||
accountUnlock := am.Store.AcquireReadLockByUID(ctx, accountID)
|
accountUnlock := am.Store.AcquireReadLockByUID(ctx, accountID)
|
||||||
defer accountUnlock()
|
defer accountUnlock()
|
||||||
peerUnlock := am.Store.AcquireWriteLockByUID(ctx, peerPubKey)
|
peerUnlock := am.Store.AcquireWriteLockByUID(ctx, peerPubKey)
|
||||||
|
|||||||
@@ -208,6 +208,8 @@ func (s *GRPCServer) Sync(req *proto.EncryptedMessage, srv proto.ManagementServi
|
|||||||
unlock()
|
unlock()
|
||||||
unlock = nil
|
unlock = nil
|
||||||
|
|
||||||
|
log.WithContext(ctx).Debugf("Sync: took %v", time.Since(reqStart))
|
||||||
|
|
||||||
return s.handleUpdates(ctx, accountID, peerKey, peer, updates, srv)
|
return s.handleUpdates(ctx, accountID, peerKey, peer, updates, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -330,10 +330,7 @@ func MigrateNewField[T any](ctx context.Context, db *gorm.DB, columnName string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
var rows []map[string]any
|
var rows []map[string]any
|
||||||
if err := tx.Table(tableName).
|
if err := tx.Table(tableName).Select("id", columnName).Where(columnName + " IS NULL").Find(&rows).Error; err != nil {
|
||||||
Select("id", columnName).
|
|
||||||
Where(columnName + " IS NULL OR " + columnName + " = ''").
|
|
||||||
Find(&rows).Error; err != nil {
|
|
||||||
return fmt.Errorf("failed to find rows with empty %s: %w", columnName, err)
|
return fmt.Errorf("failed to find rows with empty %s: %w", columnName, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,11 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/netbirdio/netbird/management/server/util"
|
|
||||||
"github.com/rs/xid"
|
"github.com/rs/xid"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"github.com/netbirdio/netbird/management/server/util"
|
||||||
|
|
||||||
"github.com/netbirdio/netbird/management/server/idp"
|
"github.com/netbirdio/netbird/management/server/idp"
|
||||||
"github.com/netbirdio/netbird/management/server/posture"
|
"github.com/netbirdio/netbird/management/server/posture"
|
||||||
"github.com/netbirdio/netbird/management/server/store"
|
"github.com/netbirdio/netbird/management/server/store"
|
||||||
@@ -111,6 +112,11 @@ func (am *DefaultAccountManager) GetPeers(ctx context.Context, accountID, userID
|
|||||||
|
|
||||||
// MarkPeerConnected marks peer as connected (true) or disconnected (false)
|
// MarkPeerConnected marks peer as connected (true) or disconnected (false)
|
||||||
func (am *DefaultAccountManager) MarkPeerConnected(ctx context.Context, peerPubKey string, connected bool, realIP net.IP, account *types.Account) error {
|
func (am *DefaultAccountManager) MarkPeerConnected(ctx context.Context, peerPubKey string, connected bool, realIP net.IP, account *types.Account) error {
|
||||||
|
start := time.Now()
|
||||||
|
defer func() {
|
||||||
|
log.WithContext(ctx).Debugf("MarkPeerConnected: took %v", time.Since(start))
|
||||||
|
}()
|
||||||
|
|
||||||
peer, err := account.FindPeerByPubKey(peerPubKey)
|
peer, err := account.FindPeerByPubKey(peerPubKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to find peer by pub key: %w", err)
|
return fmt.Errorf("failed to find peer by pub key: %w", err)
|
||||||
@@ -654,6 +660,11 @@ func (am *DefaultAccountManager) getFreeIP(ctx context.Context, s store.Store, a
|
|||||||
|
|
||||||
// SyncPeer checks whether peer is eligible for receiving NetworkMap (authenticated) and returns its NetworkMap if eligible
|
// SyncPeer checks whether peer is eligible for receiving NetworkMap (authenticated) and returns its NetworkMap if eligible
|
||||||
func (am *DefaultAccountManager) SyncPeer(ctx context.Context, sync PeerSync, account *types.Account) (*nbpeer.Peer, *types.NetworkMap, []*posture.Checks, error) {
|
func (am *DefaultAccountManager) SyncPeer(ctx context.Context, sync PeerSync, account *types.Account) (*nbpeer.Peer, *types.NetworkMap, []*posture.Checks, error) {
|
||||||
|
start := time.Now()
|
||||||
|
defer func() {
|
||||||
|
log.WithContext(ctx).Debugf("SyncPeer: took %v", time.Since(start))
|
||||||
|
}()
|
||||||
|
|
||||||
peer, err := account.FindPeerByPubKey(sync.WireGuardPubKey)
|
peer, err := account.FindPeerByPubKey(sync.WireGuardPubKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, status.NewPeerNotRegisteredError()
|
return nil, nil, nil, status.NewPeerNotRegisteredError()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
"go.opentelemetry.io/otel/metric"
|
"go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
nberrors "github.com/netbirdio/netbird/client/errors"
|
nberrors "github.com/netbirdio/netbird/client/errors"
|
||||||
@@ -58,15 +59,15 @@ func (r *Server) Listen(cfg ListenerConfig) error {
|
|||||||
|
|
||||||
tlsConfigQUIC, err := quictls.ServerQUICTLSConfig(cfg.TLSConfig)
|
tlsConfigQUIC, err := quictls.ServerQUICTLSConfig(cfg.TLSConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
log.Warnf("Not starting QUIC listener: %v", err)
|
||||||
}
|
} else {
|
||||||
|
|
||||||
quicListener := &quic.Listener{
|
quicListener := &quic.Listener{
|
||||||
Address: cfg.Address,
|
Address: cfg.Address,
|
||||||
TLSConfig: tlsConfigQUIC,
|
TLSConfig: tlsConfigQUIC,
|
||||||
}
|
}
|
||||||
|
|
||||||
r.listeners = append(r.listeners, quicListener)
|
r.listeners = append(r.listeners, quicListener)
|
||||||
|
}
|
||||||
|
|
||||||
errChan := make(chan error, len(r.listeners))
|
errChan := make(chan error, len(r.listeners))
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
|
|||||||
Reference in New Issue
Block a user