api

package
v0.0.0-...-dea3d9d Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 46 Imported by: 0

Documentation

Overview

Package Menshen LEAP API

the purpose of this application is to provide a service that uses go code and libraries to define the VPN provisioning API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertGenHelper

func CertGenHelper(registry *registry, ovpnCaCrt string, ovpnCaKey string, algo string, expiryDays int, addRootCa bool) func(echo.Context) error

GenerateCert godoc @Summary Get openvpn cert @Description Fetch a new key and cert. @Tags Provisioning @Accept json @Produce json @Success 200 {object} string @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /api/5/openvpn/cert [get]

func DownloadConfigHelper

func DownloadConfigHelper(registry *registry, cfg *Config) func(echo.Context) error

DownloadConfig godoc. @Summary Fetch OpenVPN Config File. @Description fetch a working config file for OpenVPN service. @Tags Provisioning @Produce text/plain @Success 200 {object} string @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /api/autoconf [get]

func GenConfigHelper

func GenConfigHelper(registry *registry, cfg *Config) func(echo.Context) error

GenerateConfig godoc. @Summary Fetch OpenVPN Config File. @Description fetch a working config file for OpenVPN service. @Tags Provisioning @Produce text/plain @Success 200 {object} string @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /api/5/openvpn/config [get]

func GetLocationsFromEIPData

func GetLocationsFromEIPData(eip *m.EIPServiceV3) locationMap

func InitMetricsServer

func InitMetricsServer() *echo.Echo

func InitServer

func InitServer(cfg *Config) *echo.Echo

func ParseEIPServiceFile

func ParseEIPServiceFile(path string) (*m.EIPServiceV3, error)

func ParseProviderJsonFile

func ParseProviderJsonFile(path string) (*m.Provider, error)

Types

type Config

type Config struct {
	EnableCertv3        bool
	AllowGatewayListing bool
	AllowBridgeListing  bool
	AutoTLS             bool
	// EIP is an existing EIPv3 file in the local filesystem (legacy)
	EIP string
	// EIPULR is a remote endpoint where to fetch an existing EIPv3 file from (legacy)
	EIPURL string
	// LocalBridges is a list of addresses where the available bridge
	// containers expose their control ports.
	LocalBridges        []string
	LoadBalancerAddr    string
	Port                int
	PortMetrics         int
	ServerName          string
	ClientCertURL       string
	CaFile              string
	OvpnCaCrt           string
	OvpnCaKey           string
	OvpnClientCrtExpiry int
	// ProviderJson is a file path to an existing provider.json
	ProviderJson   string
	Algo           string
	DBFile         string
	AgentSharedKey string

	// This is the amount of milliseconds to wait since the last heartbeat from a bridge or gateway before
	// removing them from the resources that are returned to clients.
	// If this is zero then no cutoff will be applied
	LastSeenCutoffMillis int64
}

func (*Config) HasLegacyEIPFile

func (c *Config) HasLegacyEIPFile() bool

Jump to

Keyboard shortcuts

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