Documentation
¶
Index ¶
- Constants
- Variables
- func AppliedZoneCandidateFromZone(z nmdata.CustomZone, distributionGroups []string) networkmap.AppliedZoneCandidate
- func ConvertAllToSharedTypes[T any, T1 any](allsrc []T) ([]T1, error)
- func ConvertToNmdataPeers(peers []Peer) ([]nmdata.Peer, map[string][]*nmdata.Peer, error)
- func ConvertToNmdataPolicy(policies []Policy) ([]nmdata.Policy, map[string]map[string]any, map[string]map[string]any, error)
- func FromSqlTypesToSharedTypes(src reflect.Value, dst reflect.Value) error
- func RecordTypeAndRdata(t, rdata string) (int, string, error)
- func StructFields(s any) []any
- func TwinProxyDomains(domains []Domain) []nmdata.ProxyDomain
- func ZonesToAppliedZoneCandidates(zones []Zone) ([]networkmap.AppliedZoneCandidate, error)
- type Account
- type AccountNetwork
- type Domain
- type Metrics
- type NameserverGroup
- type Network
- type NetworkMapDBStore
- type NetworkMapDBStoreConn
- type NetworkMapDBStoreImpl
- type Networkresource
- type Peer
- type Policy
- type PostureChecks
- type Route
- type Service
- type Zone
Constants ¶
const ( NMAP_STRUCT_TAG = "nmap" NMAP_SKIP = "skip" NMAP_MAP_TO = "map_to" NMAP_JSON = "json" )
Variables ¶
var ErrDnsUnsupportedRecordType = errors.New("unsupported record type")
var ErrNoRows = errors.New("no rows in result set")
Functions ¶
func AppliedZoneCandidateFromZone ¶
func AppliedZoneCandidateFromZone(z nmdata.CustomZone, distributionGroups []string) networkmap.AppliedZoneCandidate
func ConvertAllToSharedTypes ¶
func ConvertToNmdataPeers ¶
func ConvertToNmdataPolicy ¶
func StructFields ¶
func TwinProxyDomains ¶
func TwinProxyDomains(domains []Domain) []nmdata.ProxyDomain
TwinProxyDomains converts registered reverse-proxy domain rows to their slim twins, so private-service zone apex resolution runs on the twin.
func ZonesToAppliedZoneCandidates ¶
func ZonesToAppliedZoneCandidates(zones []Zone) ([]networkmap.AppliedZoneCandidate, error)
Types ¶
type Account ¶
type Account struct {
PeerLoginExpirationEnabled sql.NullBool
PeerLoginExpiration sql.NullInt64
PeerInactivityExpirationEnabled sql.NullBool
PeerInactivityExpiration sql.NullInt64
DNSDomain sql.NullString
IPv6EnabledGroups []byte `nmap:"json"`
RoutingPeerDNSResolutionEnabled sql.NullBool
LazyConnectionEnabled sql.NullBool
AutoUpdateVersion sql.NullString
AutoUpdateAlways sql.NullBool
MetricsPushEnabled sql.NullBool
}
type AccountNetwork ¶
type AccountNetwork struct {
Identifier sql.NullString
Net []byte `nmap:"json"`
NetV6 []byte `nmap:"json"`
Dns sql.NullString
Serial sql.NullInt64
}
type Domain ¶
type Domain struct {
Domain sql.NullString
TargetCluster sql.NullString
}
type Metrics ¶ added in v0.82.0
type Metrics struct {
// contains filtered or unexported fields
}
Metrics records which database serves network map data reads, how long reads wait for the replica and the state of the connection pools.
type NameserverGroup ¶
type Network ¶
type Network struct {
ID string
PublicID sql.NullString
}
type NetworkMapDBStore ¶
type NetworkMapDBStoreConn ¶
type NetworkMapDBStoreConn interface {
GetGroups(ctx context.Context, accountId string) ([]nmdata.Group, map[string]map[string]any, error)
GetDomains(ctx context.Context, accountId string) ([]Domain, error)
GetPeers(ctx context.Context, accountId string) ([]nmdata.Peer, map[string][]*nmdata.Peer, error)
GetPolicies(ctx context.Context, accountId string) ([]nmdata.Policy, map[string]map[string]any, map[string]map[string]any, error)
GetRoutes(ctx context.Context, accountId string) ([]nmdata.Route, error)
GetNameServerGroups(ctx context.Context, accountId string) ([]nmdata.NameServerGroup, error)
GetNetworkResources(ctx context.Context, accountId string) ([]nmdata.NetworkResource, error)
GetNetworkRouters(ctx context.Context, accountId string) (map[string]map[string]*nmdata.NetworkRouter, error)
GetNetwork(ctx context.Context, accountId string) (nmdata.Network, error)
GetAppliedZoneCandidates(ctx context.Context, accountId string) ([]networkmap.AppliedZoneCandidate, error)
GetAccountSettings(ctx context.Context, accountId string) (nmdata.AccountSettingsInfo, error)
GetPostureChecks(ctx context.Context, accountId string) ([]nmdata.PostureChecks, map[string]string, error)
GetAllowedUsers(ctx context.Context, accountId string) (map[string]struct{}, map[string][]string, error)
GetDnsSettings(ctx context.Context, accountId string) (nmdata.DNSSettings, error)
GetNetworkXIDToPublicIdMap(ctx context.Context, accountId string) (map[string]string, error)
GetPrivateServices(ctx context.Context, accountId string) ([]Service, error)
GetProxyTargetedDomainResourceIDs(ctx context.Context, accountId string) (map[string]struct{}, error)
CommitTx(ctx context.Context) error
RollbackTx(ctx context.Context) error
}
type NetworkMapDBStoreImpl ¶
type NetworkMapDBStoreImpl struct {
Store NetworkMapDBStore
// Replica is an optional read replica of Store that serves reads once it has
// replicated the account's current network serial.
Replica NetworkMapDBStore
// ReplicaWait bounds how long a read waits for Replica before it falls back to Store.
ReplicaWait time.Duration
// Metrics records how reads are served. It is optional.
Metrics *Metrics
IntegratedPeerValidator integrated_validator.IntegratedValidator
ExtraSettingsManager settings.Manager
}
func (*NetworkMapDBStoreImpl) GetNetworkMapData ¶
func (s *NetworkMapDBStoreImpl) GetNetworkMapData(ctx context.Context, accountId string) (*networkmap.NetworkMapData, error)
GetNetworkMapData reads the network map data of the account. With a Replica configured it reads from the replica once that has replicated the account's current network serial, and from Store when it does not catch up within ReplicaWait or the replica read fails.
type Networkresource ¶
type Networkresource struct {
ID string
NetworkID sql.NullString
AccountID sql.NullString
PublicID sql.NullString
Name sql.NullString
Description sql.NullString
Type sql.NullString
Domain sql.NullString
Prefix []byte `nmap:"json"`
Enabled sql.NullBool
}
type Peer ¶
type Peer struct {
ID string
Key sql.NullString
SSHKey sql.NullString
DNSLabel sql.NullString
ExtraDNSLabels []byte `nmap:"json"`
UserID sql.NullString
SSHEnabled sql.NullBool
LoginExpirationEnabled sql.NullBool
LastLogin sql.NullTime
IP []byte `nmap:"json"`
IPv6 []byte `nmap:"json"`
PeerStatusRequiresApproval sql.NullBool `nmap:"map_to:RequiresApproval"`
PeerStatusConnected sql.NullBool `nmap:"skip"`
ProxyMetaEmbedded sql.NullBool `nmap:"skip"`
ProxyMetaCluster sql.NullString `nmap:"skip"`
MetaWtVersion sql.NullString `nmap:"skip"`
MetaGoOS sql.NullString `nmap:"skip"`
MetaOSVersion sql.NullString `nmap:"skip"`
MetaKernelVersion sql.NullString `nmap:"skip"`
MetaNetworkAddresses []byte `nmap:"skip,json"`
MetaFiles []byte `nmap:"skip,json"`
MetaCertificates []byte `nmap:"skip,json"`
MetaCapabilities []byte `nmap:"skip,json"`
MetaFlags []byte `nmap:"skip,json"`
MetaSyncMessageVersion sql.NullInt64 `nmap:"skip"`
LocationCountryCode sql.NullString `nmap:"skip"`
LocationCityName sql.NullString `nmap:"skip"`
LocationConnectionIp []byte `nmap:"skip,json"`
}
Depending on db interface LastLogin contains time in different formats: for sqlite/sql.NullTime the time in UTC for pgx the time is in the local timezone TODO add support for creating struct fields from denormalized fields
type Policy ¶
type Policy struct {
ID string
PublicID sql.NullString
Enabled sql.NullBool
SourcePostureChecks []byte `nmap:"json"`
RuleEnabled sql.NullBool `nmap:"skip"`
Action sql.NullString `nmap:"skip"`
Protocol sql.NullString `nmap:"skip"`
Bidirectional sql.NullBool `nmap:"skip"`
Sources []byte `nmap:"skip,json"`
Destinations []byte `nmap:"skip,json"`
SourceResource []byte `nmap:"skip,json"`
DestinationResource []byte `nmap:"skip,json"`
Ports []byte `nmap:"skip,json"`
PortRanges []byte `nmap:"skip,json"`
AuthorizedGroups []byte `nmap:"skip,json"`
AuthorizedUser sql.NullString `nmap:"skip"`
}
type PostureChecks ¶
type PostureChecks struct {
ID string
PublicID sql.NullString `nmap:"skip"`
Checks []byte `nmap:"json"`
}
type Route ¶
type Route struct {
ID string
AccountID sql.NullString
PublicID sql.NullString
Network []byte `nmap:"json"`
Domains []byte `nmap:"json"`
KeepRoute sql.NullBool
NetID sql.NullString
Description sql.NullString
Peer sql.NullString
PeerID sql.NullString
PeerGroups []byte `nmap:"json"`
NetworkType sql.NullInt64
Masquerade sql.NullBool
Metric sql.NullInt64
Enabled sql.NullBool
Groups []byte `nmap:"json"`
AccessControlGroups []byte `nmap:"json"`
SkipAutoApply sql.NullBool
}
type Service ¶
type Service struct {
Enabled sql.NullBool
Private sql.NullBool
AccessGroups []string
ProxyCluster sql.NullString
Domain sql.NullString
}
type Zone ¶
type Zone struct {
Id string `nmap:"skip"`
Domain sql.NullString
SearchDomainDisabled sql.NullBool
DistributionGroups []byte `nmap:"skip,json"`
RecordName sql.NullString `nmap:"skip"`
RecordType sql.NullString `nmap:"skip"`
RecordClass sql.NullString `nmap:"skip"`
RecordTTL sql.NullInt64 `nmap:"skip"`
RecordRData sql.NullString `nmap:"skip"`
}