host

package
v0.0.0-...-d505baf Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendConfig

func AppendConfig() (err error)

AppendConfig append vpn config for user

func WriteConfigToLocal

func WriteConfigToLocal() (err error)

WriteConfigToLocal is write vpn config to local,node machine sync by rsync tool

Types

type BaseConfigService

type BaseConfigService struct {
}

BaseConfigService is an implement for config service

func (*BaseConfigService) GetVPNConfig

func (s *BaseConfigService) GetVPNConfig(ctx context.Context, user *models.CommonUser) (config *models.UserVPNConfig, err error)

GetVPNConfig return vpn config

type ConfigHandler

type ConfigHandler struct {
	common.BaseHandler
	Service ConfigService
}

ConfigHandler is config handler

func (*ConfigHandler) GetHostList

func (h *ConfigHandler) GetHostList(ctx *fasthttp.RequestCtx)

GetHostList get host list that user can used

func (*ConfigHandler) GetVPNConfig

func (h *ConfigHandler) GetVPNConfig(ctx *fasthttp.RequestCtx)

GetVPNConfig get personal vpn config

type ConfigService

type ConfigService interface {
	GetVPNConfig(ctx context.Context, user *models.CommonUser) (config *models.UserVPNConfig, err error)
}

ConfigService vpn config service interface

func NewConfigService

func NewConfigService() ConfigService

NewConfigService create a new service

type VPNConfigResponse

type VPNConfigResponse struct {
	Enable   bool            `json:"enable"`
	UserName string          `json:"userName"`
	Password string          `json:"password"`
	Hosts    []VPNHostConfig `json:"hosts"`
	Start    int64           `json:"start"`
	End      int64           `json:"end"`
	Level    int             `json:"level"`
	Package  int             `json:"package"`
}

VPNConfigResponse vpn config

type VPNHostConfig

type VPNHostConfig struct {
	ID     uint   `json:"id"`
	Name   string `json:"name"`
	IP     string `json:"ip"`
	Icon   string `json:"icon"`
	Type   int    `json:"type"`
	Remark string `json:"remark"`
}

VPNHostConfig vpn host config

Jump to

Keyboard shortcuts

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