31 lines
669 B
Go
31 lines
669 B
Go
package privateinternetaccess
|
|
|
|
import (
|
|
"math/rand"
|
|
"time"
|
|
|
|
"github.com/qdm12/gluetun/internal/constants/openvpn"
|
|
"github.com/qdm12/gluetun/internal/models"
|
|
)
|
|
|
|
type PIA struct {
|
|
servers []models.Server
|
|
randSource rand.Source
|
|
timeNow func() time.Time
|
|
// Port forwarding
|
|
portForwardPath string
|
|
authFilePath string
|
|
}
|
|
|
|
func New(servers []models.Server, randSource rand.Source,
|
|
timeNow func() time.Time) *PIA {
|
|
const jsonPortForwardPath = "/gluetun/piaportforward.json"
|
|
return &PIA{
|
|
servers: servers,
|
|
timeNow: timeNow,
|
|
randSource: randSource,
|
|
portForwardPath: jsonPortForwardPath,
|
|
authFilePath: openvpn.AuthConf,
|
|
}
|
|
}
|