Documentation ¶
Index ¶
- Constants
- Variables
- type ActiveClient
- type CIDR
- type Change
- type CleanupParams
- type Client
- type Connection
- type DNSRoute
- type DNSRouteResult
- type DetailedRoute
- type GetRouteByIpParams
- type HostnameClient
- type HostnameRoute
- type HostnameRouteResult
- type IPRouteClient
- type IpRouteFilter
- func (f *IpRouteFilter) CommentIs(comment string)
- func (f *IpRouteFilter) Deleted()
- func (f IpRouteFilter) Encode() string
- func (f *IpRouteFilter) ExistedAt(existedAt time.Time)
- func (f *IpRouteFilter) MaxFetchSize(max uint)
- func (f *IpRouteFilter) NetworkIsSubsetOf(superset net.IPNet)
- func (f *IpRouteFilter) NetworkIsSupersetOf(subset net.IPNet)
- func (f *IpRouteFilter) NotDeleted()
- func (f *IpRouteFilter) Page(page int)
- func (f *IpRouteFilter) TunnelID(id uuid.UUID)
- func (f *IpRouteFilter) VNetID(id uuid.UUID)
- type LBRoute
- type LBRouteResult
- type NewRoute
- type NewVirtualNetwork
- type Pagination
- type RESTClient
- func (r *RESTClient) AddRoute(newRoute NewRoute) (Route, error)
- func (r *RESTClient) CleanupConnections(tunnelID uuid.UUID, params *CleanupParams) error
- func (r *RESTClient) CreateTunnel(name string, tunnelSecret []byte) (*TunnelWithToken, error)
- func (r *RESTClient) CreateVirtualNetwork(newVnet NewVirtualNetwork) (VirtualNetwork, error)
- func (r *RESTClient) DeleteRoute(id uuid.UUID) error
- func (r *RESTClient) DeleteTunnel(tunnelID uuid.UUID, cascade bool) error
- func (r *RESTClient) DeleteVirtualNetwork(id uuid.UUID, force bool) error
- func (r *RESTClient) GetByIP(params GetRouteByIpParams) (DetailedRoute, error)
- func (r *RESTClient) GetManagementToken(tunnelID uuid.UUID) (token string, err error)
- func (r *RESTClient) GetTunnel(tunnelID uuid.UUID) (*Tunnel, error)
- func (r *RESTClient) GetTunnelToken(tunnelID uuid.UUID) (token string, err error)
- func (r *RESTClient) ListActiveClients(tunnelID uuid.UUID) ([]*ActiveClient, error)
- func (r *RESTClient) ListRoutes(filter *IpRouteFilter) ([]*DetailedRoute, error)
- func (r *RESTClient) ListTunnels(filter *TunnelFilter) ([]*Tunnel, error)
- func (r *RESTClient) ListVirtualNetworks(filter *VnetFilter) ([]*VirtualNetwork, error)
- func (r *RESTClient) RouteTunnel(tunnelID uuid.UUID, route HostnameRoute) (HostnameRouteResult, error)
- func (r *RESTClient) UpdateVirtualNetwork(id uuid.UUID, updates UpdateVirtualNetwork) error
- type Route
- type Tunnel
- type TunnelClient
- type TunnelFilter
- func (f *TunnelFilter) ByExistedAt(existedAt time.Time)
- func (f *TunnelFilter) ByName(name string)
- func (f *TunnelFilter) ByNamePrefix(namePrefix string)
- func (f *TunnelFilter) ByTunnelID(tunnelID uuid.UUID)
- func (f *TunnelFilter) ExcludeNameWithPrefix(excludePrefix string)
- func (f *TunnelFilter) MaxFetchSize(max uint)
- func (f *TunnelFilter) NoDeleted()
- func (f *TunnelFilter) Page(page int)
- type TunnelWithToken
- type UpdateVirtualNetwork
- type VirtualNetwork
- type VnetClient
- type VnetFilter
Constants ¶
const ( ChangeNew = "new" ChangeUpdated = "updated" ChangeUnchanged = "unchanged" )
const (
TimeLayout = time.RFC3339
)
Variables ¶
var ( ErrBadRequest = errors.New("incorrect request parameters") ErrNotFound = errors.New("not found") ErrAPINoSuccess = errors.New("API call failed") )
var ErrTunnelNameConflict = errors.New("tunnel with name already exists")
var (
// Flags contains all filter flags.
IpRouteFilterFlags = []cli.Flag{
&filterIpRouteDeleted,
&filterIpRouteTunnelID,
&filterSubsetIpRoute,
&filterSupersetIpRoute,
&filterIpRouteComment,
&filterIpRouteByVnet,
}
)
var (
VnetFilterFlags = []cli.Flag{
&filterVnetId,
&filterVnetByName,
&filterDefaultVnet,
&filterDeletedVnet,
}
)
Functions ¶
This section is empty.
Types ¶
type ActiveClient ¶
type CIDR ¶
CIDR is just a newtype wrapper around net.IPNet. It adds JSON unmarshalling.
func (CIDR) MarshalJSON ¶
func (*CIDR) UnmarshalJSON ¶
UnmarshalJSON parses a JSON string into net.IPNet
type CleanupParams ¶
type CleanupParams struct {
// contains filtered or unexported fields
}
func NewCleanupParams ¶
func NewCleanupParams() *CleanupParams
func (*CleanupParams) ForClient ¶
func (cp *CleanupParams) ForClient(clientID uuid.UUID)
type Client ¶
type Client interface { TunnelClient HostnameClient IPRouteClient VnetClient }
type Connection ¶
type DNSRoute ¶
type DNSRoute struct {
// contains filtered or unexported fields
}
func (*DNSRoute) MarshalJSON ¶
func (*DNSRoute) RecordType ¶
func (*DNSRoute) UnmarshalResult ¶
func (dr *DNSRoute) UnmarshalResult(body io.Reader) (HostnameRouteResult, error)
type DNSRouteResult ¶
type DNSRouteResult struct { CName Change `json:"cname"` Name string `json:"name"` // contains filtered or unexported fields }
func (*DNSRouteResult) SuccessSummary ¶
func (res *DNSRouteResult) SuccessSummary() string
type DetailedRoute ¶
type DetailedRoute struct { ID uuid.UUID `json:"id"` Network CIDR `json:"network"` TunnelID uuid.UUID `json:"tunnel_id"` // Optional field. When unset, it means the DetailedRoute belongs to the default virtual network. VNetID *uuid.UUID `json:"virtual_network_id,omitempty"` Comment string `json:"comment"` CreatedAt time.Time `json:"created_at"` DeletedAt time.Time `json:"deleted_at"` TunnelName string `json:"tunnel_name"` }
DetailedRoute is just a Route with some extra fields, e.g. TunnelName.
func (*DetailedRoute) IsZero ¶
func (r *DetailedRoute) IsZero() bool
IsZero checks if DetailedRoute is the zero value.
func (DetailedRoute) TableString ¶
func (r DetailedRoute) TableString() string
TableString outputs a table row summarizing the route, to be used when showing the user their routing table.
type GetRouteByIpParams ¶
type HostnameClient ¶
type HostnameClient interface {
RouteTunnel(tunnelID uuid.UUID, route HostnameRoute) (HostnameRouteResult, error)
}
type HostnameRoute ¶
type HostnameRoute interface { json.Marshaler RecordType() string UnmarshalResult(body io.Reader) (HostnameRouteResult, error) String() string }
HostnameRoute represents a record type that can route to a tunnel
func NewDNSRoute ¶
func NewDNSRoute(userHostname string, overwriteExisting bool) HostnameRoute
func NewLBRoute ¶
func NewLBRoute(lbName, lbPool string) HostnameRoute
type HostnameRouteResult ¶
type HostnameRouteResult interface { // SuccessSummary explains what will route to this tunnel when it's provisioned successfully SuccessSummary() string }
type IPRouteClient ¶
type IPRouteClient interface { ListRoutes(filter *IpRouteFilter) ([]*DetailedRoute, error) AddRoute(newRoute NewRoute) (Route, error) DeleteRoute(id uuid.UUID) error GetByIP(params GetRouteByIpParams) (DetailedRoute, error) }
type IpRouteFilter ¶
type IpRouteFilter struct {
// contains filtered or unexported fields
}
IpRouteFilter which routes get queried.
func NewIPRouteFilter ¶
func NewIPRouteFilter() *IpRouteFilter
func NewIpRouteFilterFromCLI ¶
func NewIpRouteFilterFromCLI(c *cli.Context) (*IpRouteFilter, error)
NewIpRouteFilterFromCLI parses CLI flags to discover which filters should get applied.
func (*IpRouteFilter) CommentIs ¶
func (f *IpRouteFilter) CommentIs(comment string)
func (*IpRouteFilter) Deleted ¶
func (f *IpRouteFilter) Deleted()
func (IpRouteFilter) Encode ¶
func (f IpRouteFilter) Encode() string
func (*IpRouteFilter) ExistedAt ¶
func (f *IpRouteFilter) ExistedAt(existedAt time.Time)
func (*IpRouteFilter) MaxFetchSize ¶
func (f *IpRouteFilter) MaxFetchSize(max uint)
func (*IpRouteFilter) NetworkIsSubsetOf ¶
func (f *IpRouteFilter) NetworkIsSubsetOf(superset net.IPNet)
func (*IpRouteFilter) NetworkIsSupersetOf ¶
func (f *IpRouteFilter) NetworkIsSupersetOf(subset net.IPNet)
func (*IpRouteFilter) NotDeleted ¶
func (f *IpRouteFilter) NotDeleted()
func (*IpRouteFilter) Page ¶
func (f *IpRouteFilter) Page(page int)
func (*IpRouteFilter) TunnelID ¶
func (f *IpRouteFilter) TunnelID(id uuid.UUID)
func (*IpRouteFilter) VNetID ¶
func (f *IpRouteFilter) VNetID(id uuid.UUID)
type LBRoute ¶
type LBRoute struct {
// contains filtered or unexported fields
}
func (*LBRoute) MarshalJSON ¶
func (*LBRoute) RecordType ¶
func (*LBRoute) UnmarshalResult ¶
func (lr *LBRoute) UnmarshalResult(body io.Reader) (HostnameRouteResult, error)
type LBRouteResult ¶
type LBRouteResult struct { LoadBalancer Change `json:"load_balancer"` Pool Change `json:"pool"` // contains filtered or unexported fields }
func (*LBRouteResult) SuccessSummary ¶
func (res *LBRouteResult) SuccessSummary() string
type NewRoute ¶
type NewRoute struct { Network net.IPNet TunnelID uuid.UUID Comment string // Optional field. If unset, backend will assume the default vnet for the account. VNetID *uuid.UUID }
NewRoute has all the parameters necessary to add a new route to the table.
func (NewRoute) MarshalJSON ¶
MarshalJSON handles fields with non-JSON types (e.g. net.IPNet).
type NewVirtualNetwork ¶
type Pagination ¶
type RESTClient ¶
type RESTClient struct {
// contains filtered or unexported fields
}
func NewRESTClient ¶
func NewRESTClient(baseURL, accountTag, zoneTag, authToken, userAgent string, log *zerolog.Logger) (*RESTClient, error)
func (*RESTClient) AddRoute ¶
func (r *RESTClient) AddRoute(newRoute NewRoute) (Route, error)
AddRoute calls the Tunnelstore POST endpoint for a given route.
func (*RESTClient) CleanupConnections ¶
func (r *RESTClient) CleanupConnections(tunnelID uuid.UUID, params *CleanupParams) error
func (*RESTClient) CreateTunnel ¶
func (r *RESTClient) CreateTunnel(name string, tunnelSecret []byte) (*TunnelWithToken, error)
func (*RESTClient) CreateVirtualNetwork ¶
func (r *RESTClient) CreateVirtualNetwork(newVnet NewVirtualNetwork) (VirtualNetwork, error)
func (*RESTClient) DeleteRoute ¶
func (r *RESTClient) DeleteRoute(id uuid.UUID) error
DeleteRoute calls the Tunnelstore DELETE endpoint for a given route.
func (*RESTClient) DeleteTunnel ¶
func (r *RESTClient) DeleteTunnel(tunnelID uuid.UUID, cascade bool) error
func (*RESTClient) DeleteVirtualNetwork ¶
func (r *RESTClient) DeleteVirtualNetwork(id uuid.UUID, force bool) error
func (*RESTClient) GetByIP ¶
func (r *RESTClient) GetByIP(params GetRouteByIpParams) (DetailedRoute, error)
GetByIP checks which route will proxy a given IP.
func (*RESTClient) GetManagementToken ¶
func (r *RESTClient) GetManagementToken(tunnelID uuid.UUID) (token string, err error)
func (*RESTClient) GetTunnelToken ¶
func (r *RESTClient) GetTunnelToken(tunnelID uuid.UUID) (token string, err error)
func (*RESTClient) ListActiveClients ¶
func (r *RESTClient) ListActiveClients(tunnelID uuid.UUID) ([]*ActiveClient, error)
func (*RESTClient) ListRoutes ¶
func (r *RESTClient) ListRoutes(filter *IpRouteFilter) ([]*DetailedRoute, error)
ListRoutes calls the Tunnelstore GET endpoint for all routes under an account. Due to pagination on the server side it will call the endpoint multiple times if needed.
func (*RESTClient) ListTunnels ¶
func (r *RESTClient) ListTunnels(filter *TunnelFilter) ([]*Tunnel, error)
func (*RESTClient) ListVirtualNetworks ¶
func (r *RESTClient) ListVirtualNetworks(filter *VnetFilter) ([]*VirtualNetwork, error)
func (*RESTClient) RouteTunnel ¶
func (r *RESTClient) RouteTunnel(tunnelID uuid.UUID, route HostnameRoute) (HostnameRouteResult, error)
func (*RESTClient) UpdateVirtualNetwork ¶
func (r *RESTClient) UpdateVirtualNetwork(id uuid.UUID, updates UpdateVirtualNetwork) error
type Route ¶
type Route struct { Network CIDR `json:"network"` TunnelID uuid.UUID `json:"tunnel_id"` // Optional field. When unset, it means the Route belongs to the default virtual network. VNetID *uuid.UUID `json:"virtual_network_id,omitempty"` Comment string `json:"comment"` CreatedAt time.Time `json:"created_at"` DeletedAt time.Time `json:"deleted_at"` }
Route is a mapping from customer's IP space to a tunnel. Each route allows the customer to route eyeballs in their corporate network to certain private IP ranges. Each Route represents an IP range in their network, and says that eyeballs can reach that route using the corresponding tunnel.
type TunnelClient ¶
type TunnelClient interface { CreateTunnel(name string, tunnelSecret []byte) (*TunnelWithToken, error) GetTunnel(tunnelID uuid.UUID) (*Tunnel, error) GetTunnelToken(tunnelID uuid.UUID) (string, error) GetManagementToken(tunnelID uuid.UUID) (string, error) DeleteTunnel(tunnelID uuid.UUID, cascade bool) error ListTunnels(filter *TunnelFilter) ([]*Tunnel, error) ListActiveClients(tunnelID uuid.UUID) ([]*ActiveClient, error) CleanupConnections(tunnelID uuid.UUID, params *CleanupParams) error }
type TunnelFilter ¶
type TunnelFilter struct {
// contains filtered or unexported fields
}
func NewTunnelFilter ¶
func NewTunnelFilter() *TunnelFilter
func (*TunnelFilter) ByExistedAt ¶
func (f *TunnelFilter) ByExistedAt(existedAt time.Time)
func (*TunnelFilter) ByName ¶
func (f *TunnelFilter) ByName(name string)
func (*TunnelFilter) ByNamePrefix ¶
func (f *TunnelFilter) ByNamePrefix(namePrefix string)
func (*TunnelFilter) ByTunnelID ¶
func (f *TunnelFilter) ByTunnelID(tunnelID uuid.UUID)
func (*TunnelFilter) ExcludeNameWithPrefix ¶
func (f *TunnelFilter) ExcludeNameWithPrefix(excludePrefix string)
func (*TunnelFilter) MaxFetchSize ¶
func (f *TunnelFilter) MaxFetchSize(max uint)
func (*TunnelFilter) NoDeleted ¶
func (f *TunnelFilter) NoDeleted()
func (*TunnelFilter) Page ¶
func (f *TunnelFilter) Page(page int)
type TunnelWithToken ¶
type UpdateVirtualNetwork ¶
type VirtualNetwork ¶
type VirtualNetwork struct { ID uuid.UUID `json:"id"` Comment string `json:"comment"` Name string `json:"name"` IsDefault bool `json:"is_default_network"` CreatedAt time.Time `json:"created_at"` DeletedAt time.Time `json:"deleted_at"` }
func (VirtualNetwork) TableString ¶
func (virtualNetwork VirtualNetwork) TableString() string
type VnetClient ¶
type VnetClient interface { CreateVirtualNetwork(newVnet NewVirtualNetwork) (VirtualNetwork, error) ListVirtualNetworks(filter *VnetFilter) ([]*VirtualNetwork, error) DeleteVirtualNetwork(id uuid.UUID, force bool) error UpdateVirtualNetwork(id uuid.UUID, updates UpdateVirtualNetwork) error }
type VnetFilter ¶
type VnetFilter struct {
// contains filtered or unexported fields
}
VnetFilter which virtual networks get queried.
func NewFromCLI ¶
func NewFromCLI(c *cli.Context) (*VnetFilter, error)
NewFromCLI parses CLI flags to discover which filters should get applied to list virtual networks.
func NewVnetFilter ¶
func NewVnetFilter() *VnetFilter
func (*VnetFilter) ByDefaultStatus ¶
func (f *VnetFilter) ByDefaultStatus(isDefault bool)
func (*VnetFilter) ById ¶
func (f *VnetFilter) ById(vnetId uuid.UUID)
func (*VnetFilter) ByName ¶
func (f *VnetFilter) ByName(name string)
func (VnetFilter) Encode ¶
func (f VnetFilter) Encode() string
func (*VnetFilter) MaxFetchSize ¶
func (f *VnetFilter) MaxFetchSize(max uint)
func (*VnetFilter) WithDeleted ¶
func (f *VnetFilter) WithDeleted(isDeleted bool)