localclient

package
v1.106.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: BSD-3-Clause Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package localclient provides an interface for all the local.Client methods kube needs to use, so that we can easily mock it in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertIssuer

type CertIssuer interface {
	CertPair(context.Context, string) ([]byte, []byte, error)
	// CertStatus reports the state of the cached cert for domain without
	// fetching or issuing one.
	CertStatus(context.Context, string) (*tailcfg.C2NTLSCertInfo, error)
}

type FakeIPNBusWatcher

type FakeIPNBusWatcher struct {
	NotifyChan chan ipn.Notify
}

func (*FakeIPNBusWatcher) Close

func (f *FakeIPNBusWatcher) Close() error

func (*FakeIPNBusWatcher) Next

func (f *FakeIPNBusWatcher) Next() (ipn.Notify, error)

type FakeLocalClient

type FakeLocalClient struct {
	FakeIPNBusWatcher
	SetServeCalled    bool
	EditPrefsCalls    []*ipn.MaskedPrefs
	GetPrefsResult    *ipn.Prefs
	CertDomainsResult []string
	// CertStatusResults maps a domain to the cert status the fake returns.
	// Domains absent from the map are reported as missing.
	CertStatusResults map[string]*tailcfg.C2NTLSCertInfo
}

func (*FakeLocalClient) CertDomains added in v1.98.0

func (f *FakeLocalClient) CertDomains(ctx context.Context) ([]string, error)

func (*FakeLocalClient) CertPair

func (f *FakeLocalClient) CertPair(ctx context.Context, domain string) ([]byte, []byte, error)

func (*FakeLocalClient) CertStatus added in v1.106.0

func (f *FakeLocalClient) CertStatus(ctx context.Context, domain string) (*tailcfg.C2NTLSCertInfo, error)

func (*FakeLocalClient) EditPrefs added in v1.96.0

func (m *FakeLocalClient) EditPrefs(ctx context.Context, mp *ipn.MaskedPrefs) (*ipn.Prefs, error)

func (*FakeLocalClient) GetPrefs added in v1.96.0

func (m *FakeLocalClient) GetPrefs(ctx context.Context) (*ipn.Prefs, error)

func (*FakeLocalClient) SetServeConfig added in v1.96.0

func (m *FakeLocalClient) SetServeConfig(ctx context.Context, cfg *ipn.ServeConfig) error

func (*FakeLocalClient) WatchIPNBus

func (f *FakeLocalClient) WatchIPNBus(ctx context.Context, mask ipn.NotifyWatchOpt) (IPNBusWatcher, error)

type IPNBusWatcher

type IPNBusWatcher interface {
	io.Closer
	Next() (ipn.Notify, error)
}

IPNBusWatcher is local.IPNBusWatcher's methods restated in an interface to allow for easier mocking in tests.

type LocalClient

type LocalClient interface {
	WatchIPNBus(ctx context.Context, mask ipn.NotifyWatchOpt) (IPNBusWatcher, error)
	SetServeConfig(context.Context, *ipn.ServeConfig) error
	EditPrefs(ctx context.Context, mp *ipn.MaskedPrefs) (*ipn.Prefs, error)
	CertDomains(ctx context.Context) ([]string, error)
	CertIssuer
}

LocalClient is roughly a subset of the local.Client struct's methods, used for easier testing.

func New

func New(lc *local.Client) LocalClient

New returns a LocalClient that wraps the provided local.Client.

Jump to

Keyboard shortcuts

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