summaryrefslogtreecommitdiff
path: root/types/protocol/protocol.go
blob: 85b07337a236f32e97e99ebe8436ac1b4882da50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Package protocol contains hte public type that have to do with VPN protocols
package protocol

// Protocol defines an 'enumeration' of protocols
type Protocol int8

const (
	// Unknown indicates that the protocol is not known
	Unknown Protocol = iota
	// OpenVPN indicates that the protocol is OpenVPN
	OpenVPN
	// WireGuard indicates that the protocol is WireGuard
	WireGuard
	// WireGuardTCP indicates that the protocol is WireGuard with a TCP proxy
	WireGuardTCP
)

// New creates a new protocol type from a string
func New(p string) Protocol {
	switch p {
	case "openvpn":
		return OpenVPN
	case "wireguard":
		return WireGuard
	default:
		return Unknown
	}
}