mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-05-11 21:26:35 +00:00

cloudflared tail will now fetch the management token from by making a request to the Cloudflare API using the cert.pem (acquired from cloudflared login). Refactored some of the credentials code into it's own package as to allow for easier use between subcommands outside of `cloudflared tunnel`.
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package cfapi
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
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) error
|
|
ListTunnels(filter *TunnelFilter) ([]*Tunnel, error)
|
|
ListActiveClients(tunnelID uuid.UUID) ([]*ActiveClient, error)
|
|
CleanupConnections(tunnelID uuid.UUID, params *CleanupParams) error
|
|
}
|
|
|
|
type HostnameClient interface {
|
|
RouteTunnel(tunnelID uuid.UUID, route HostnameRoute) (HostnameRouteResult, error)
|
|
}
|
|
|
|
type IPRouteClient interface {
|
|
ListRoutes(filter *IpRouteFilter) ([]*DetailedRoute, error)
|
|
AddRoute(newRoute NewRoute) (Route, error)
|
|
DeleteRoute(params DeleteRouteParams) error
|
|
GetByIP(params GetRouteByIpParams) (DetailedRoute, error)
|
|
}
|
|
|
|
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 Client interface {
|
|
TunnelClient
|
|
HostnameClient
|
|
IPRouteClient
|
|
VnetClient
|
|
}
|