2021-02-06 11:05:50 -05:00
|
|
|
package configuration
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/qdm12/gluetun/internal/constants"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (settings *Provider) surfsharkLines() (lines []string) {
|
|
|
|
|
if len(settings.ServerSelection.Regions) > 0 {
|
|
|
|
|
lines = append(lines, lastIndent+"Regions: "+commaJoin(settings.ServerSelection.Regions))
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-10 01:24:46 +00:00
|
|
|
if len(settings.ServerSelection.Hostnames) > 0 {
|
|
|
|
|
lines = append(lines, lastIndent+"Hostnames: "+commaJoin(settings.ServerSelection.Hostnames))
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-06 11:05:50 -05:00
|
|
|
return lines
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (settings *Provider) readSurfshark(r reader) (err error) {
|
|
|
|
|
settings.Name = constants.Surfshark
|
|
|
|
|
|
2021-05-10 18:18:12 +00:00
|
|
|
settings.ServerSelection.TCP, err = readProtocol(r.env)
|
2021-02-06 11:05:50 -05:00
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
settings.ServerSelection.TargetIP, err = readTargetIP(r.env)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
settings.ServerSelection.Regions, err = r.env.CSVInside("REGION", constants.SurfsharkRegionChoices())
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-10 01:24:46 +00:00
|
|
|
settings.ServerSelection.Hostnames, err = r.env.CSVInside("SERVER_HOSTNAME", constants.SurfsharkHostnameChoices())
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-06 11:05:50 -05:00
|
|
|
return nil
|
|
|
|
|
}
|