withdraw

package
v1.20211214.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package withdraw uses local and cloud Tailscale APIs to withdraw a route from a Tailnet.

It uses the local API to withdraw the route to peers. Then it uses the Tailscale Cloud API to confirm the newly withdrawn route.

This is provided in a way to optimize the testable surface area (even for untested parts of the code) without having any usage of `os.Exit()`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableWithdrawnCIDR

func DisableWithdrawnCIDR(ctx context.Context, c cloud.Config, cidr netaddr.IPPrefix, hostname string) error

DisableWithdrawnCIDR ensures that a recently withdrawn CIDR is removed from the set of enabled routes in the Tailscale cloud API.

func EditPrefsWithdrawCIDR

func EditPrefsWithdrawCIDR(ctx context.Context, cidr netaddr.IPPrefix) error

EditPrefsWithdrawCIDR updates existing Tailscale preferences to withdraw a routes advertised by the current Tailscale node.

If the accept routes flag and the advertised CIDR are both present, this will make no changes.

func WithdrawAndDisable

func WithdrawAndDisable(ctx context.Context, c Config) error

WithdrawAndDisable first uses the local `tailscaled` API to withdraw a CIDR from the Tailnet and then uses the cloud API to disable the withdrawn CIDR.

Types

type Config

type Config struct {
	APIConfig cloud.Config
	IPv4CIDR  string
}

Config provides the core set of (CLI) inputs needed to authorize a new device in a Tailnet.

func NewConfig

func NewConfig(opts ...Option) (Config, error)

NewConfig returns a new `Config` with all relevant defaults provided and options for overriding.

type Option

type Option func(*Config) error

Option represents an initialization helper that can modify a config in-place.

Jump to

Keyboard shortcuts

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