2024-03-27 18:48:48 +01:00
|
|
|
package integrated_validator
|
|
|
|
|
|
|
|
import (
|
2024-07-03 11:33:02 +02:00
|
|
|
"context"
|
|
|
|
|
2024-03-27 18:48:48 +01:00
|
|
|
"github.com/netbirdio/netbird/management/server/account"
|
|
|
|
nbgroup "github.com/netbirdio/netbird/management/server/group"
|
|
|
|
nbpeer "github.com/netbirdio/netbird/management/server/peer"
|
|
|
|
)
|
|
|
|
|
|
|
|
// IntegratedValidator interface exists to avoid the circle dependencies
|
|
|
|
type IntegratedValidator interface {
|
2024-07-03 11:33:02 +02:00
|
|
|
ValidateExtraSettings(ctx context.Context, newExtraSettings *account.ExtraSettings, oldExtraSettings *account.ExtraSettings, peers map[string]*nbpeer.Peer, userID string, accountID string) error
|
2024-11-07 09:50:13 +01:00
|
|
|
ValidatePeer(ctx context.Context, update *nbpeer.Peer, peer *nbpeer.Peer, userID string, accountID string, dnsDomain string, peersGroup []string, extraSettings *account.ExtraSettings) (*nbpeer.Peer, bool, error)
|
2024-07-03 11:33:02 +02:00
|
|
|
PreparePeer(ctx context.Context, accountID string, peer *nbpeer.Peer, peersGroup []string, extraSettings *account.ExtraSettings) *nbpeer.Peer
|
|
|
|
IsNotValidPeer(ctx context.Context, accountID string, peer *nbpeer.Peer, peersGroup []string, extraSettings *account.ExtraSettings) (bool, bool, error)
|
2024-03-27 18:48:48 +01:00
|
|
|
GetValidatedPeers(accountID string, groups map[string]*nbgroup.Group, peers map[string]*nbpeer.Peer, extraSettings *account.ExtraSettings) (map[string]struct{}, error)
|
2024-07-03 11:33:02 +02:00
|
|
|
PeerDeleted(ctx context.Context, accountID, peerID string) error
|
2024-03-27 18:48:48 +01:00
|
|
|
SetPeerInvalidationListener(fn func(accountID string))
|
2024-07-03 11:33:02 +02:00
|
|
|
Stop(ctx context.Context)
|
2024-03-27 18:48:48 +01:00
|
|
|
}
|