https://github.com/stamp/go-openvpn
A go library to start and interface with openvpn processes.
https://github.com/stamp/go-openvpn
Last synced: 5 months ago
JSON representation
A go library to start and interface with openvpn processes.
- Host: GitHub
- URL: https://github.com/stamp/go-openvpn
- Owner: stamp
- License: mit
- Created: 2014-11-07T14:57:17.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-10-13T03:19:57.000Z (over 4 years ago)
- Last Synced: 2024-06-19T05:43:18.160Z (almost 2 years ago)
- Language: Go
- Size: 26.4 KB
- Stars: 56
- Watchers: 6
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-openvpn
==========
A go library to start and interface with openvpn processes.
### Basic static key example
First use the following command to create a PSK (pre shared key)
openvpn --genkey --secret pre-shared.key
#### Server
// Create an instance of the openvpn struct
p := openvpn.NewStaticKeyServer("pre-shared.key")
// Start the openvpn process. Note that this method do not block so the program will continue at once.
p.Start()
// Listen for events
for {
select {
case event := <-p.Events:
log.Println("Event: ", event.Name, "(", event.Args, ")")
}
}
#### Client
// Create an instance of the openvpn struct
p := openvpn.NewStaticKeyClient("localhost", "pre-shared.key")
// Start the openvpn process. Note that this method do not block so the program will continue at once.
p.Start()
// Listen for events
for {
select {
case event := <-p.Events:
log.Println("Event: ", event.Name, "(", event.Args, ")")
}
}