syncer

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, want *catalog.File, api API, host Host, pol PolicyAPI, opts Options, w io.Writer) error

func ApplyConfigured

func ApplyConfigured(ctx context.Context, cat *catalog.File, opts Options, w io.Writer) error

ApplyConfigured wires API and host clients, then reconciles the catalog.

func FprintPlan

func FprintPlan(w io.Writer, p Plan)

func PublishedNames

func PublishedNames(cat *catalog.File, names []string) []string

PublishedNames returns catalog names that are published among the given ids.

func RepublishNames

func RepublishNames(ctx context.Context, cat *catalog.File, names []string, w io.Writer) error

RepublishNames runs VIP, Serve, and advertise for catalog names. It does not write the ACL.

Types

type API

type API interface {
	List(ctx context.Context) ([]tailscale.Service, error)
	CreateOrUpdate(ctx context.Context, svc tailscale.Service) error
	Delete(ctx context.Context, name string) error
}

type Change

type Change struct {
	Name   string
	Action string // create, update, unchanged
	Detail string
}

type ClientAPI

type ClientAPI struct {
	Services *tailscale.ServicesResource
}

func (ClientAPI) CreateOrUpdate

func (c ClientAPI) CreateOrUpdate(ctx context.Context, svc tailscale.Service) error

func (ClientAPI) Delete

func (c ClientAPI) Delete(ctx context.Context, name string) error

func (ClientAPI) List

func (c ClientAPI) List(ctx context.Context) ([]tailscale.Service, error)

type ClientPolicy

type ClientPolicy struct {
	Policy *tailscale.PolicyFileResource
}

func (ClientPolicy) Get

func (c ClientPolicy) Get(ctx context.Context) (*tailscale.ACL, error)

func (ClientPolicy) Raw

func (c ClientPolicy) Raw(ctx context.Context) (string, string, error)

func (ClientPolicy) SetRaw

func (c ClientPolicy) SetRaw(ctx context.Context, body, etag string) error

func (ClientPolicy) ValidateRaw

func (c ClientPolicy) ValidateRaw(ctx context.Context, body string) error

type Host

type Host interface {
	GetConfig(ctx context.Context) (*catalog.ServeFile, error)
	EnsureHostTags(ctx context.Context, tags []string, resetNode bool) error
	Serve(ctx context.Context, name, endpoint, local string) error
	Advertise(ctx context.Context, svc string) error
	Drain(ctx context.Context, svc string) error
	Clear(ctx context.Context, name, endpoint string) error
}

type Options

type Options struct {
	DryRun    bool
	Tailnet   bool
	Host      bool
	Advertise bool
	Policy    bool
	// Names limits VIP puts, Serve, and steady-state advertise to these
	// catalog names (or vip / svc: aliases). Empty means every service.
	// ACL merge stays catalog-wide. After a policy write, every service
	// is drained, re-served, and advertised.
	Names []string
	// Prune deletes VIP Services and Serve mappings whose svc: name is
	// not in this catalog, and rewrites the catalog-owned 443 grant.
	Prune bool
	// ResetNode allows tailscale up --reset when tagging the node.
	ResetNode bool
}

type Plan

type Plan struct {
	Tailnet []Change
	Host    []Change
	Policy  []policy.Change
}

func ComputePlan

func ComputePlan(want *catalog.File, have []tailscale.Service, serve *catalog.ServeFile) Plan

func (Plan) NeedsApply

func (p Plan) NeedsApply() bool

type PolicyAPI

type PolicyAPI interface {
	Get(ctx context.Context) (*tailscale.ACL, error)
	Raw(ctx context.Context) (body, etag string, err error)
	SetRaw(ctx context.Context, body, etag string) error
	ValidateRaw(ctx context.Context, body string) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL