2020-06-13 14:08:29 -04:00
|
|
|
package provider
|
|
|
|
|
|
|
|
|
|
import (
|
2020-10-12 10:55:08 -04:00
|
|
|
"context"
|
|
|
|
|
|
2022-01-06 06:40:23 -05:00
|
|
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
2020-07-26 12:07:06 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/models"
|
2021-09-23 16:58:21 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/provider/utils"
|
2020-06-13 14:08:29 -04:00
|
|
|
)
|
|
|
|
|
|
2020-10-20 02:45:28 +00:00
|
|
|
// Provider contains methods to read and modify the openvpn configuration to connect as a client.
|
2020-06-13 14:08:29 -04:00
|
|
|
type Provider interface {
|
2022-09-12 21:31:37 +00:00
|
|
|
GetConnection(selection settings.ServerSelection, ipv6Supported bool) (connection models.Connection, err error)
|
2022-09-06 12:16:29 +00:00
|
|
|
OpenVPNConfig(connection models.Connection, settings settings.OpenVPN, ipv6Supported bool) (lines []string)
|
2022-06-07 16:58:08 +00:00
|
|
|
Name() string
|
2021-07-28 08:35:44 -07:00
|
|
|
PortForwarder
|
2022-06-09 23:47:12 +00:00
|
|
|
FetchServers(ctx context.Context, minServers int) (
|
|
|
|
|
servers []models.Server, err error)
|
2021-07-28 08:35:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PortForwarder interface {
|
2023-09-23 12:57:12 +02:00
|
|
|
Name() string
|
2023-09-23 11:46:14 +00:00
|
|
|
PortForward(ctx context.Context, objects utils.PortForwardObjects) (
|
2021-07-28 08:35:44 -07:00
|
|
|
port uint16, err error)
|
2023-09-23 11:46:14 +00:00
|
|
|
KeepPortForward(ctx context.Context, objects utils.PortForwardObjects) (err error)
|
2020-06-13 14:08:29 -04:00
|
|
|
}
|