mirror of
https://github.com/WireGuard/wgctrl-go.git
synced 2024-11-11 11:39:17 +00:00
317097aa87
Starting with Go 1.17, //go:build lines are preferred over // +build lines, see https://golang.org/doc/go1.17#build-lines and https://golang.org/design/draft-gobuild for details. This change was generated by running Go 1.17 go fmt ./... which automatically adds //go:build lines based on the existing // +build lines. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
34 lines
727 B
Go
34 lines
727 B
Go
//go:build openbsd
|
|
// +build openbsd
|
|
|
|
package wgctrl
|
|
|
|
import (
|
|
"golang.zx2c4.com/wireguard/wgctrl/internal/wginternal"
|
|
"golang.zx2c4.com/wireguard/wgctrl/internal/wgopenbsd"
|
|
"golang.zx2c4.com/wireguard/wgctrl/internal/wguser"
|
|
)
|
|
|
|
// newClients configures wginternal.Clients for OpenBSD systems.
|
|
func newClients() ([]wginternal.Client, error) {
|
|
var clients []wginternal.Client
|
|
|
|
// OpenBSD has an in-kernel WireGuard implementation. Determine if it is
|
|
// available and make use of it if so.
|
|
kc, ok, err := wgopenbsd.New()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if ok {
|
|
clients = append(clients, kc)
|
|
}
|
|
|
|
uc, err := wguser.New()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
clients = append(clients, uc)
|
|
return clients, nil
|
|
}
|