softetherapi

package module
v0.0.0-...-82343b5 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 7 Imported by: 0

README

SoftEther VPN Server JSON-RPC API in Golang

This is the SoftEther VPN Server JSON-RPC API wrapper in Go. See a document for more information.

support

supported API methods

  • Test
  • GetServerInfo
  • GetServerStatus
  • CreateListener
  • EnumListener
  • DeleteListener
  • EnableListener
  • SetServerPassword
  • CreateHub
  • SetHub
  • EnumHub
  • DeleteHub
  • GetHubStatus
  • SetHubOnline
  • EnumConnection
  • DisconnectConnection
  • GetConnectionInfo
  • CreateLink
  • GetLink
  • SetLink
  • EnumLink
  • SetLinkOnline
  • SetLinkOffline
  • DeleteLink
  • CreateUser
  • SetUser
  • GetUser
  • EnumUser
  • EnableSecureNAT
  • DisableSecureNAT
  • SetSecureNATOption
  • GetSecureNATOption
  • EnumNAT
  • EnumDHCP
  • EnumEthernet
  • AddLocalBridge
  • DeleteLocalBridge
  • EnumLocalBridge
  • GetBridgeSupport

Usage

To use this package, import this package like bellow.

import softether "github.com/chwjbn/go-softether-api"

First, you have to create a new Api instance.

api := softether.New("localhost", 443, "default", "password")

Second, You can create api methods you want to call. API methods are in methods package. These methods implement the Method interface. For example, to call Test method.

method := methods.NewTest()

And execute api.Call(). Then, result will return as map[string](interface{}).

res, err := api.Call(method)
	if err != nil {
		panic(err)
	}
	fmt.Println(res)

Future works

I'm making api methods as needed. Other methods will be supported.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api struct {
	Host     string
	Port     int
	Hub      string
	Password string
	// contains filtered or unexported fields
}

to handle softether vpn server json-rpc api

func New

func New(host string, port int, hub, password string) *Api

func (*Api) Call

func (api *Api) Call(method pkg.Method) (map[string]interface{}, error)

type Id

type Id interface {
	Incl()
	Describe() int
}

Id interface is used for request id

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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