server

package
v0.0.0-...-07d8892 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(next jsonrpc.Handler) jsonrpc.Handler

Logger logs JSON-RPC requests.

func PreventReferer

func PreventReferer(next http.Handler) http.Handler

PreventReferer blocks any request that contains a Referer or Origin header, as this would indicate a web browser is submitting the request and this server should NOT be directly accessible that way.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the host-side implementation of the WireGuard-API Client. It supports both Kernel and Userland implementations of WireGuard.

func NewServer

func NewServer(wg *wgctrl.Client, deviceName string) (*Server, error)

NewServer initializes a Server with a WireGuard client.

func (*Server) AddPeer

AddPeer inserts a new Peer into the WireGuard interfaces table, multiple calls to AddPeer can be used to update details of the Peer.

func (*Server) GetDeviceInfo

GetDeviceInfo returns information such as the public key and type of interface for the currently configured device.

func (*Server) GetPeer

GetPeer retrieves a specific Peer by their public key.

func (*Server) ListPeers

ListPeers retrieves information about all Peers known to the current WireGuard interface, including allowed IP addresses and usage stats, optionally with pagination.

func (*Server) RemovePeer

RemovePeer deletes a Peer from the WireGuard interfaces table by their public key,

func (*Server) ServeJSONRPC

func (s *Server) ServeJSONRPC(w jsonrpc.ResponseWriter, r *jsonrpc.Request)

ServeJSONRPC handles incomming WireGuard-API requests.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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