chore(portforward): move vpn gateway obtention within port forwarding service

This commit is contained in:
Quentin McGaw
2023-09-23 11:46:14 +00:00
parent 71201411f4
commit 0406de399d
14 changed files with 135 additions and 92 deletions

View File

@@ -0,0 +1,27 @@
package utils
import (
"net/http"
"net/netip"
)
// PortForwardObjects contains fields that may or may not need to be set
// depending on the port forwarding provider code.
type PortForwardObjects struct {
// Logger is a logger, used by both Private Internet Access and ProtonVPN.
Logger Logger
// Gateway is the VPN gateway IP address, used by Private Internet Access
// and ProtonVPN.
Gateway netip.Addr
// Client is used to query the VPN gateway for Private Internet Access.
Client *http.Client
// ServerName is used by Private Internet Access for port forwarding,
// and to look up the server data from storage.
// TODO use server data directly to remove storage dependency for port
// forwarding implementation.
ServerName string
}
type Routing interface {
VPNLocalGatewayIP(vpnInterface string) (gateway netip.Addr, err error)
}