core

package
v0.0.0-...-a31a683 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: GPL-3.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version  string
	CodeHash string
)

These variables will be set at build time

View Source
var CaddyConfDir = os.Getenv("WG_CONF_DIR")

WG_CONF_DIR

View Source
var CaddyFile = os.Getenv("CADDY_INTERFACE_NAME")
View Source
var CaddyJSON = "caddy.json"

var AppConfDir = "./conf"

View Source
var ChainName string
View Source
var NodeConfig string
View Source
var NodeName string
View Source
var NodeType string
View Source
var WalletAddress string

Functions

func DeleteClient

func DeleteClient(id string) error

DeleteClient from disk

func GenerateEthereumWalletAddress

func GenerateEthereumWalletAddress(mnemonic string)

GenerateEthereumWalletAddress generates an Ethereum wallet address from the given mnemonic

func GeneratePeaqDID

func GeneratePeaqDID(length int) (string, string, error)

LENGTH 16

func GenerateWalletAddressAptos

func GenerateWalletAddressAptos(mnemonic string)

GenerateWalletAddressAptos generates an Aptos wallet address from the given mnemonic

func GenerateWalletAddressSolana

func GenerateWalletAddressSolana(mnemonic string)

GenerateWalletAddressSolana generates a Solana wallet address from the given mnemonic

func GenerateWalletAddressSui

func GenerateWalletAddressSui(mnemonic string)

GenerateWalletAddressSui generates a Sui wallet address from the given mnemonic

func GetAllReservedIps

func GetAllReservedIps() ([]string, error)

GetAllReservedIps the list of all reserved IPs, client and server

func GetIPInfo

func GetIPInfo()

func GetPort

func GetPort(max, min int) (int, error)

GetPort returns available port based on random generation

func GetServerStatus

func GetServerStatus() (*model.Status, error)

Method to get the server status

func Init

func Init()

Init initializes json file for caddy

func IsValidPeaqDID

func IsValidPeaqDID(did string) bool

func LoadNodeDetails

func LoadNodeDetails()

Function to load the node details from the environment and save it to the global variable

func MakeErrorResponse

func MakeErrorResponse(status int64, err string, server *model.Server, client *model.Client, clients []*model.Client) *model.Response

error response message

func MakeSucessResponse

func MakeSucessResponse(status int64, message string, server *model.Server, client *model.Client, clients []*model.Client) *model.Response

success response message

func ReadClient

func ReadClient(id string) (*model.Client, error)

ReadClient client by id

func ReadClientConfig

func ReadClientConfig(id string) ([]byte, error)

func ReadClients

func ReadClients() ([]*model.Client, error)

ReadClients all clients

func ReadServer

func ReadServer() (*model.Server, error)

ReadServer object, create default one

func ReadWgConfigFile

func ReadWgConfigFile() ([]byte, error)

ReadWgConfigFile return content of wireguard config file

func RegisterClient

func RegisterClient(client *model.Client) (*model.Client, error)

RegisterClient client with all necessary data

func ScanPort

func ScanPort(port int) (string, error)

ScanPort checks avilability of port

func UpdateClient

func UpdateClient(UUID string, client *model.Client) (*model.Client, error)

UpdateClient preserve keys

func UpdateServer

func UpdateServer(server *model.Server) (*model.Server, error)

UpdateServer keep private values from existing one

func UpdateServerConfigWg

func UpdateServerConfigWg() error

UpdateServerConfigWg in wg format

func Writefile

func Writefile(path string, bytes []byte) (err error)

Writefile appends data to file

Types

type IPInfo

type IPInfo struct {
	IP       string `json:"ip"`
	City     string `json:"city"`
	Region   string `json:"region"`
	Country  string `json:"country"`
	Location string `json:"loc"`
	Org      string `json:"org"`
	Postal   string `json:"postal"`
	Timezone string `json:"timezone"`
}
var GlobalIPInfo IPInfo

Jump to

Keyboard shortcuts

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