Skip to content

clients.wireguard #

wireguard

To get started



import freeflowuniverse.herolib.clients. wireguard

mut client:= wireguard.get()!

client...

example heroscript

!!wireguard.configure
    secret: '...'
    host: 'localhost'
    port: 8888

Constants #

const version = '1.14.3'

fn get #

fn get(args_ ArgsGet) !&WireGuard

fn heroscript_default #

fn heroscript_default() !string

Todo: THIS IS EXAMPLE CODE AND NEEDS TO BE CHANGED IN LINE TO STRUCT BELOW, IS STRUCTURED AS HEROSCRIPT

fn play #

fn play(args_ PlayArgs) !

fn switch #

fn switch(name string)

switch instance to be used for wireguard

struct ArgsGet #

@[params]
struct ArgsGet {
pub mut:
	name string
}

///////FACTORY

struct DownArgs #

@[params]
struct DownArgs {
pub:
	config_file_path string @[required]
}

struct GetPublicKeyArgs #

@[params]
struct GetPublicKeyArgs {
pub:
	private_key string @[required]
}

struct PlayArgs #

@[params]
struct PlayArgs {
pub mut:
	heroscript string // if filled in then plbook will be made out of it
	plbook     ?playbook.PlayBook
	reset      bool
}

struct ShowConfigArgs #

@[params]
struct ShowConfigArgs {
pub:
	interface_name string @[required]
}

struct StartArgs #

@[params]
struct StartArgs {
pub:
	config_file_path string @[required]
}

struct WGInfo #

struct WGInfo {
pub mut:
	interface_ WGInterface
	peers      map[string]WGPeer
}

struct WGInterface #

struct WGInterface {
pub mut:
	name           string
	public_key     string
	listening_port int
}

struct WGPeer #

struct WGPeer {
pub mut:
	endpoint             string
	allowed_ips          string
	latest_handshake     string
	transfer             string
	persistent_keepalive string
}

struct WGShow #

struct WGShow {
pub mut:
	configs map[string]WGInfo
}

struct WireGuard #

@[heap]
struct WireGuard {
pub mut:
	name string = 'wireguard'
}

THIS THE THE SOURCE OF THE INFORMATION OF THIS FILE, HERE WE HAVE THE CONFIG OBJECT CONFIGURED AND MODELLED

fn (WireGuard) down #

fn (wg WireGuard) down(args DownArgs) !

fn (WireGuard) generate_private_key #

fn (wg WireGuard) generate_private_key() !string

fn (WireGuard) get_public_key #

fn (wg WireGuard) get_public_key(args GetPublicKeyArgs) !string

fn (WireGuard) show #

fn (wg WireGuard) show() !WGShow

fn (WireGuard) show_config #

fn (wg WireGuard) show_config(args ShowConfigArgs) !WGInfo

fn (WireGuard) start #

fn (wg WireGuard) start(args StartArgs) !