pritunl

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerStatusOnline  = "online"
	ServerStatusOffline = "offline"

	ServerNetworkModeTunnel = "tunnel"
	ServerNetworkModeBridge = "bridge"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	TestApiCall() error

	GetOrganizations() ([]Organization, error)
	GetOrganization(id string) (*Organization, error)
	CreateOrganization(name string) (*Organization, error)
	UpdateOrganization(id string, organization *Organization) error
	DeleteOrganization(name string) error

	GetUser(id string, orgId string) (*User, error)
	CreateUser(newUser User) (*User, error)
	UpdateUser(id string, user *User) error
	DeleteUser(id string, orgId string) error

	GetServers() ([]Server, error)
	GetServer(id string) (*Server, error)
	CreateServer(serverData map[string]interface{}) (*Server, error)
	UpdateServer(id string, server *Server) error
	DeleteServer(id string) error

	GetOrganizationsByServer(serverId string) ([]Organization, error)
	AttachOrganizationToServer(organizationId, serverId string) error
	DetachOrganizationFromServer(organizationId, serverId string) error

	GetRoutesByServer(serverId string) ([]Route, error)
	AddRouteToServer(serverId string, route Route) error
	AddRoutesToServer(serverId string, route []Route) error
	DeleteRouteFromServer(serverId string, route Route) error
	UpdateRouteOnServer(serverId string, route Route) error

	GetHosts() ([]Host, error)
	GetHostsByServer(serverId string) ([]Host, error)
	AttachHostToServer(hostId, serverId string) error
	DetachHostFromServer(hostId, serverId string) error

	StartServer(serverId string) error
	StopServer(serverId string) error
}

func NewClient

func NewClient(baseUrl, apiToken, apiSecret string, insecure bool) Client

type Host

type Host struct {
	ID       string `json:"id,omitempty"`
	Hostname string `json:"hostname"`
}

type Organization

type Organization struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name"`
}

type Pin

type Pin struct {
	// IsSet defines whenever the pin code is set. It must be true if Value is non-empty.
	IsSet bool
	// Value defines whenever the pin code is known - nonempty string is a known pin.
	Value string
}

Pin encodes a pin code which can be set or not set, as well as known or unknown.

func NewPin

func NewPin(value string) Pin

func (Pin) MarshalJSON

func (pin Pin) MarshalJSON() ([]byte, error)

func (*Pin) UnmarshalJSON

func (pin *Pin) UnmarshalJSON(data []byte) error

type PortForwarding

type PortForwarding struct {
	Dport    string `json:"dport"`
	Protocol string `json:"protocol"`
	Port     string `json:"port"`
}

type Route

type Route struct {
	Network        string `json:"network"`
	Nat            bool   `json:"nat"`
	Comment        string `json:"comment,omitempty"`
	VirtualNetwork bool   `json:"virtual_network,omitempty"`
	WgNetwork      string `json:"wg_network,omitempty"`
	NetworkLink    bool   `json:"network_link,omitempty"`
	ServerLink     bool   `json:"server_link,omitempty"`
	NetGateway     bool   `json:"net_gateway,omitempty"`
	VpcID          string `json:"vpc_id,omitempty"`
	VpcRegion      string `json:"vpc_region,omitempty"`
	Metric         string `json:"metric,omitempty"`
	Advertise      bool   `json:"advertise,omitempty"`
	NatInterface   string `json:"nat_interface,omitempty"`
	NatNetmap      string `json:"nat_netmap,omitempty"`
}

func ConvertMapToRoute

func ConvertMapToRoute(data map[string]interface{}) Route

func (Route) GetID

func (r Route) GetID() string

type Server

type Server struct {
	ID               string   `json:"id,omitempty"`
	Name             string   `json:"name"`
	Protocol         string   `json:"protocol,omitempty"`
	Cipher           string   `json:"cipher,omitempty"`
	Hash             string   `json:"hash,omitempty"`
	Port             int      `json:"port,omitempty"`
	Network          string   `json:"network,omitempty"`
	WG               bool     `json:"wg,omitempty"`
	PortWG           int      `json:"port_wg,omitempty"`
	NetworkWG        string   `json:"network_wg,omitempty"`
	NetworkMode      string   `json:"network_mode,omitempty"`
	NetworkStart     string   `json:"network_start,omitempty"`
	NetworkEnd       string   `json:"network_end,omitempty"`
	RestrictRoutes   bool     `json:"restrict_routes,omitempty"`
	IPv6             bool     `json:"ipv6,omitempty"`
	IPv6Firewall     bool     `json:"ipv6_firewall,omitempty"`
	BindAddress      string   `json:"bind_address,omitempty"`
	DhParamBits      int      `json:"dh_param_bits,omitempty"`
	Groups           []string `json:"groups,omitempty"`
	MultiDevice      bool     `json:"multi_device,omitempty"`
	DnsServers       []string `json:"dns_servers,omitempty"`
	SearchDomain     string   `json:"search_domain,omitempty"`
	InterClient      bool     `json:"inter_client,omitempty"`
	PingInterval     int      `json:"ping_interval,omitempty"`
	PingTimeout      int      `json:"ping_timeout,omitempty"`
	LinkPingInterval int      `json:"link_ping_interval,omitempty"`
	LinkPingTimeout  int      `json:"link_ping_timeout,omitempty"`
	InactiveTimeout  int      `json:"inactive_timeout,omitempty"`
	SessionTimeout   int      `json:"session_timeout,omitempty"`
	AllowedDevices   string   `json:"allowed_devices,omitempty"`
	MaxClients       int      `json:"max_clients,omitempty"`
	MaxDevices       int      `json:"max_devices,omitempty"`
	ReplicaCount     int      `json:"replica_count,omitempty"`
	VxLan            bool     `json:"vxlan,omitempty"`
	DnsMapping       bool     `json:"dns_mapping,omitempty"`
	PreConnectMsg    string   `json:"pre_connect_msg,omitempty"`
	OtpAuth          bool     `json:"otp_auth,omitempty"`
	MssFix           int      `json:"mss_fix,omitempty"`
	LzoCompression   bool     `json:"lzo_compression,omitempty"`
	BlockOutsideDns  bool     `json:"block_outside_dns,omitempty"`
	JumboFrames      bool     `json:"jumbo_frames,omitempty"`
	Debug            bool     `json:"debug,omitempty"`
	Status           string   `json:"status,omitempty"`
}

func (*Server) MarshalJSON

func (s *Server) MarshalJSON() ([]byte, error)

type User

type User struct {
	ID              string                   `json:"id,omitempty"`
	Name            string                   `json:"name"`
	Type            string                   `json:"type,omitempty"`
	AuthType        string                   `json:"auth_type,omitempty"`
	DnsServers      []string                 `json:"dns_servers,omitempty"`
	Pin             Pin                      `json:"pin,omitempty"`
	DnsSuffix       string                   `json:"dns_suffix,omitempty"`
	DnsMapping      string                   `json:"dns_mapping,omitempty"`
	Disabled        bool                     `json:"disabled,omitempty"`
	NetworkLinks    []string                 `json:"network_links,omitempty"`
	PortForwarding  []map[string]interface{} `json:"port_forwarding,omitempty"`
	Email           string                   `json:"email,omitempty"`
	Status          bool                     `json:"status,omitempty"`
	OtpSecret       string                   `json:"otp_secret,omitempty"`
	ClientToClient  bool                     `json:"client_to_client,omitempty"`
	MacAddresses    []string                 `json:"mac_addresses,omitempty"`
	YubicoID        string                   `json:"yubico_id,omitempty"`
	SSO             interface{}              `json:"sso,omitempty"`
	BypassSecondary bool                     `json:"bypass_secondary,omitempty"`
	Groups          []string                 `json:"groups,omitempty"`
	Audit           bool                     `json:"audit,omitempty"`
	Gravatar        bool                     `json:"gravatar,omitempty"`
	OtpAuth         bool                     `json:"otp_auth,omitempty"`
	Organization    string                   `json:"organization,omitempty"`
}

Jump to

Keyboard shortcuts

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