Wireguard support for Mullvad and Windscribe (#565)
- `internal/wireguard` client package with unit tests - Implementation works with kernel space or user space if unavailable - `WIREGUARD_PRIVATE_KEY` - `WIREGUARD_ADDRESS` - `WIREGUARD_PRESHARED_KEY` - `WIREGUARD_PORT` - `internal/netlink` package used by `internal/wireguard`
This commit is contained in:
@@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
type Connection struct {
|
||||
// Type is the connection type and can be "openvpn"
|
||||
// Type is the connection type and can be "openvpn" or "wireguard"
|
||||
Type string `json:"type"`
|
||||
// IP is the VPN server IP address.
|
||||
IP net.IP `json:"ip"`
|
||||
@@ -15,13 +15,17 @@ type Connection struct {
|
||||
// Protocol can be "tcp" or "udp".
|
||||
Protocol string `json:"protocol"`
|
||||
// Hostname is used for IPVanish, IVPN, Privado
|
||||
// and Windscribe for TLS verification
|
||||
// and Windscribe for TLS verification.
|
||||
Hostname string `json:"hostname"`
|
||||
// PubKey is the public key of the VPN server,
|
||||
// used only for Wireguard.
|
||||
PubKey string `json:"pubkey"`
|
||||
}
|
||||
|
||||
func (c *Connection) Equal(other Connection) bool {
|
||||
return c.IP.Equal(other.IP) && c.Port == other.Port &&
|
||||
c.Protocol == other.Protocol && c.Hostname == other.Hostname
|
||||
c.Protocol == other.Protocol && c.Hostname == other.Hostname &&
|
||||
c.PubKey == other.PubKey
|
||||
}
|
||||
|
||||
func (c Connection) OpenVPNRemoteLine() (line string) {
|
||||
|
||||
@@ -48,6 +48,7 @@ type IvpnServer struct {
|
||||
}
|
||||
|
||||
type MullvadServer struct {
|
||||
VPN string `json:"vpn"`
|
||||
IPs []net.IP `json:"ips"`
|
||||
IPsV6 []net.IP `json:"ipsv6"`
|
||||
Country string `json:"country"`
|
||||
@@ -55,6 +56,7 @@ type MullvadServer struct {
|
||||
Hostname string `json:"hostname"`
|
||||
ISP string `json:"isp"`
|
||||
Owned bool `json:"owned"`
|
||||
WgPubKey string `json:"wgpubkey,omitempty"`
|
||||
}
|
||||
|
||||
type NordvpnServer struct { //nolint:maligned
|
||||
@@ -149,9 +151,11 @@ type VyprvpnServer struct {
|
||||
}
|
||||
|
||||
type WindscribeServer struct {
|
||||
VPN string `json:"vpn"`
|
||||
Region string `json:"region"`
|
||||
City string `json:"city"`
|
||||
Hostname string `json:"hostname"`
|
||||
OvpnX509 string `json:"x509"`
|
||||
OvpnX509 string `json:"x509,omitempty"`
|
||||
WgPubKey string `json:"wgpubkey,omitempty"`
|
||||
IPs []net.IP `json:"ips"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user