Documentation ¶
Overview ¶
Package provisioner provides an interface into DigitalOcean which can be used to provision a VPN endpoint.
Index ¶
Constants ¶
View Source
const ( // Constants for endpoint status. Starting = "starting" Running = "running" Failed = "failed" Destroyed = "destroyed" )
Variables ¶
View Source
var ErrNoToken = fmt.Errorf("No token provided.")
ErrNoToken is used when the token is empty.
View Source
var ErrNotFound = fmt.Errorf("Endpoint not found!")
ErrNotFound is used when the endpoint can not be found.
View Source
var ErrTokenInvalid = fmt.Errorf("Token is not valid!")
ErrTokenInvalid is used when the provided token is not valid.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct { ID string `json:"id"` IP string `json:"-"` Config string `json:"config"` DropletID int `json:"-"` Status string `json:"status"` }
Endpoint contains information describing a VPN endpoint.
type Provisioner ¶
type Provisioner interface { // CreateEndpoint stats the creation of a new endpoint in the specified region. // The provisioning itself will happen in a goroutine which will emit a signal when finished. CreateEndpoint(string) Endpoint // GetEndpoint returns the data for an endpoint with the specified ID or an error if not found. GetEndpoint(string) (Endpoint, error) // ListEndpoints returns a slice of all known endpoints. Not all endpoints will have connection information // if they were created by another provisioner. ListEndpoints() []Endpoint // DestroyEndpoint removes the endpoint from DigitalOcean. // If the endpoint can not be found this function will return an error. DestroyEndpoint(string) (Endpoint, error) // ListRegions returns a slice with all known regions. ListRegions() ([]Region, error) // Signal returns the signal channel used by this provisioner. Signal() chan struct{} }
Provisioner can be used to provision VPN endpoints.
func NewProvisioner ¶
func NewProvisioner(token string) (Provisioner, error)
NewProvisioner creates a new Provisioner with the specified DigitalOcean token.
type Region ¶
type Region struct { // Name of region. This is used when provisioning an endpoint. Name string `json:"name"` // User readable description of the region. Description string `json:"description"` // Country the region is supposedly in (ISO two-letter code). Country string `json:"country"` }
Region contains data about a region that can be used for provisioning an endpoint.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.