2023-05-21 19:37:59 +03:00
|
|
|
package types
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"net/netip"
|
|
|
|
|
|
|
|
|
|
"gorm.io/gorm"
|
|
|
|
|
)
|
|
|
|
|
|
2025-02-26 07:22:55 -08:00
|
|
|
// Deprecated: Approval of routes is denormalised onto the relevant node.
|
|
|
|
|
// Struct is kept for GORM migrations only.
|
2023-05-21 19:37:59 +03:00
|
|
|
type Route struct {
|
|
|
|
|
gorm.Model
|
|
|
|
|
|
2025-01-23 13:40:23 +01:00
|
|
|
NodeID uint64 `gorm:"not null"`
|
2024-12-13 19:15:24 +00:00
|
|
|
Node *Node
|
2023-12-09 18:09:24 +01:00
|
|
|
|
2024-10-02 11:41:58 +02:00
|
|
|
Prefix netip.Prefix `gorm:"serializer:text"`
|
2023-05-21 19:37:59 +03:00
|
|
|
|
2025-02-26 07:22:55 -08:00
|
|
|
// Advertised is now only stored as part of [Node.Hostinfo].
|
2023-05-21 19:37:59 +03:00
|
|
|
Advertised bool
|
|
|
|
|
|
all: apply godoc [Name] link conventions across comments
Every Go-identifier reference in // and /* */ comments now uses
godoc's [Name] linking syntax so pkg.go.dev and `go doc` render
them as clickable cross-references. No behaviour change.
Pattern applied across the tree:
In-package [Foo], [Foo.Bar]
Cross-package [pkg.Foo], [pkg.Foo.Bar]
Stdlib [netip.Prefix], [errors.Is], [context.Context]
Tailscale [tailcfg.MapResponse], [tailcfg.Node.CapMap],
[tailcfg.NodeAttrSuggestExitNode]
Skip rules:
- File:line refs left as plain text
- HuJSON wire keys inside backtick raw strings untouched
- ACL/policy syntax tokens (tag:foo, autogroup:self, ...) not Go
symbols, left as plain text
- JSON/OIDC wire keys, gorm tags, RFC IPv6 placeholders, markdown
link tags, decorative dividers — all left as-is
2026-05-18 18:35:53 +00:00
|
|
|
// Enabled is stored directly on the node as [Node.ApprovedRoutes].
|
2025-02-26 07:22:55 -08:00
|
|
|
Enabled bool
|
2023-12-09 18:09:24 +01:00
|
|
|
|
2025-02-26 07:22:55 -08:00
|
|
|
// IsPrimary is only determined in memory as it is only relevant
|
|
|
|
|
// when the server is up.
|
|
|
|
|
IsPrimary bool
|
2023-12-09 18:09:24 +01:00
|
|
|
}
|
|
|
|
|
|
2025-02-26 07:22:55 -08:00
|
|
|
// Deprecated: Approval of routes is denormalised onto the relevant node.
|
|
|
|
|
type Routes []Route
|