Documentation ¶
Overview ¶
Package tailscale provides the interface and client to interact with the tailscale API.
Index ¶
- type Client
- type Device
- type Interface
- type InterfaceMock
- func (mock *InterfaceMock) GetTags(ip net.IP) ([]string, error)
- func (mock *InterfaceMock) GetTagsCalls() []struct{ ... }
- func (mock *InterfaceMock) Refresh(ctx context.Context) error
- func (mock *InterfaceMock) RefreshCalls() []struct{ ... }
- func (mock *InterfaceMock) Run(ctx context.Context, refreshInterval time.Duration)
- func (mock *InterfaceMock) RunCalls() []struct{ ... }
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Client *http.Client Tailnet string Token string // contains filtered or unexported fields }
Client is a client that interacts with the TSTag service.
func (*Client) GetTags ¶
GetTags returns the tags for the given device that is identified by the IP address.
type Interface ¶
type Interface interface { // Run starts the client and refreshes the data from the TSTag service. Run(ctx context.Context, refreshInterval time.Duration) // Refresh refreshes the data from the tailscale. Refresh(ctx context.Context) error // GetTags returns the tags for the given device that is identified by the IP address. GetTags(ip net.IP) (tags []string, err error) }
Interface is an interface that provides the information about the IP address from the TSTag service.
type InterfaceMock ¶ added in v0.8.0
type InterfaceMock struct { // GetTagsFunc mocks the GetTags method. GetTagsFunc func(ip net.IP) ([]string, error) // RefreshFunc mocks the Refresh method. RefreshFunc func(ctx context.Context) error // RunFunc mocks the Run method. RunFunc func(ctx context.Context, refreshInterval time.Duration) // contains filtered or unexported fields }
InterfaceMock is a mock implementation of Interface.
func TestSomethingThatUsesInterface(t *testing.T) { // make and configure a mocked Interface mockedInterface := &InterfaceMock{ GetTagsFunc: func(ip net.IP) ([]string, error) { panic("mock out the GetTags method") }, RefreshFunc: func(ctx context.Context) error { panic("mock out the Refresh method") }, RunFunc: func(ctx context.Context, refreshInterval time.Duration) { panic("mock out the Run method") }, } // use mockedInterface in code that requires Interface // and then make assertions. }
func (*InterfaceMock) GetTags ¶ added in v0.8.0
func (mock *InterfaceMock) GetTags(ip net.IP) ([]string, error)
GetTags calls GetTagsFunc.
func (*InterfaceMock) GetTagsCalls ¶ added in v0.8.0
func (mock *InterfaceMock) GetTagsCalls() []struct { IP net.IP }
GetTagsCalls gets all the calls that were made to GetTags. Check the length with:
len(mockedInterface.GetTagsCalls())
func (*InterfaceMock) Refresh ¶ added in v0.8.0
func (mock *InterfaceMock) Refresh(ctx context.Context) error
Refresh calls RefreshFunc.
func (*InterfaceMock) RefreshCalls ¶ added in v0.8.0
func (mock *InterfaceMock) RefreshCalls() []struct { Ctx context.Context }
RefreshCalls gets all the calls that were made to Refresh. Check the length with:
len(mockedInterface.RefreshCalls())
Click to show internal directories.
Click to hide internal directories.