clients.wireguard #
wireguard
To get started
import incubaid.herolib.clients. wireguard
mut client:= wireguard.get()!
client...
example heroscript
!!wireguard.configure
secret: '...'
host: 'localhost'
port: 8888
Constants #
const version = '1.14.3'
fn delete #
fn delete(args ArgsGet) !
fn exists #
fn exists(args ArgsGet) !bool
does the config exists?
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 heroscript_dumps #
fn heroscript_dumps(obj WireGuard) !string
///////////NORMALLY NO NEED TO TOUCH
fn heroscript_loads #
fn heroscript_loads(heroscript string) !WireGuard
fn list #
fn list(args ArgsList) ![]&WireGuard
if fromdb set: load from filesystem, and not from mem, will also reset what is in mem
fn new #
fn new(args ArgsGet) !&WireGuard
fn play #
fn play(mut plbook PlayBook) !
fn set #
fn set(o WireGuard) !
register the config for the future
fn switch #
fn switch(name string)
switch instance to be used for wireguard
struct ArgsGet #
@[params]
struct ArgsGet {
pub mut:
name string = 'default'
fromdb bool // will load from filesystem
create bool // default will not create if not exist
}
///////FACTORY
struct ArgsList #
@[params]
struct ArgsList {
pub mut:
fromdb bool // will load from filesystem
}
struct DownArgs #
@[params]
struct DownArgs {
pub:
config_file_path string @[required]
}
struct GetPublicKeyArgs #
@[params]
struct GetPublicKeyArgs {
pub:
private_key string @[required]
}
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) !
- README
- Constants
- fn delete
- fn exists
- fn get
- fn heroscript_default
- fn heroscript_dumps
- fn heroscript_loads
- fn list
- fn new
- fn play
- fn set
- fn switch
- struct ArgsGet
- struct ArgsList
- struct DownArgs
- struct GetPublicKeyArgs
- struct ShowConfigArgs
- struct StartArgs
- struct WGInfo
- struct WGInterface
- struct WGPeer
- struct WGShow
- struct WireGuard