chore(lint): upgrade linter from v1.56.2 to v1.61.0
- Remove no longer needed exclude rules - Add new exclude rules for printf govet errors - Remove deprecated linters `execinquery` and `exportloopref` - Rename linter `goerr113` to `err113` - Rename linter `gomnd` to `mnd`
This commit is contained in:
@@ -7,27 +7,12 @@ issues:
|
|||||||
- path: _test\.go
|
- path: _test\.go
|
||||||
linters:
|
linters:
|
||||||
- dupl
|
- dupl
|
||||||
- goerr113
|
- err113
|
||||||
- containedctx
|
- containedctx
|
||||||
- goconst
|
|
||||||
- maintidx
|
- maintidx
|
||||||
- path: "internal\\/server\\/.+\\.go"
|
- path: "internal\\/server\\/.+\\.go"
|
||||||
linters:
|
linters:
|
||||||
- dupl
|
- dupl
|
||||||
- path: "internal\\/configuration\\/settings\\/.+\\.go"
|
|
||||||
linters:
|
|
||||||
- dupl
|
|
||||||
- text: "^mnd: Magic number: 0[0-9]{3}, in <argument> detected$"
|
|
||||||
source: "^.+= os\\.OpenFile\\(.+, .+, 0[0-9]{3}\\)"
|
|
||||||
linters:
|
|
||||||
- gomnd
|
|
||||||
- text: "^mnd: Magic number: 0[0-9]{3}, in <argument> detected$"
|
|
||||||
source: "^.+= os\\.MkdirAll\\(.+, 0[0-9]{3}\\)"
|
|
||||||
linters:
|
|
||||||
- gomnd
|
|
||||||
- linters:
|
|
||||||
- lll
|
|
||||||
source: "^//go:generate .+$"
|
|
||||||
- text: "returns interface \\(github\\.com\\/vishvananda\\/netlink\\.Link\\)"
|
- text: "returns interface \\(github\\.com\\/vishvananda\\/netlink\\.Link\\)"
|
||||||
linters:
|
linters:
|
||||||
- ireturn
|
- ireturn
|
||||||
@@ -35,18 +20,14 @@ issues:
|
|||||||
text: "newCipherDESCBCBlock returns interface \\(github\\.com\\/youmark\\/pkcs8\\.Cipher\\)"
|
text: "newCipherDESCBCBlock returns interface \\(github\\.com\\/youmark\\/pkcs8\\.Cipher\\)"
|
||||||
linters:
|
linters:
|
||||||
- ireturn
|
- ireturn
|
||||||
- path: "internal\\/firewall\\/.*\\.go"
|
- path: "internal\\/configuration"
|
||||||
text: "string `-i ` has [1-9][0-9]* occurrences, make it a constant"
|
text: "printf: non-constant format string in call to \\(\\*github.com\\/qdm12\\/gotree\\.Node\\)\\.Appendf"
|
||||||
linters:
|
linters:
|
||||||
- goconst
|
- govet
|
||||||
- path: "internal\\/provider\\/ipvanish\\/updater\\/servers.go"
|
- path: "internal\\/configuration"
|
||||||
text: "string ` in ` has 3 occurrences, make it a constant"
|
text: "non-constant format string in call to github\\.com\\/qdm12\\/gotree\\.New"
|
||||||
linters:
|
linters:
|
||||||
- goconst
|
- govet
|
||||||
- path: "internal\\/vpn\\/portforward.go"
|
|
||||||
text: 'directive `//nolint:ireturn` is unused for linter "ireturn"'
|
|
||||||
linters:
|
|
||||||
- nolintlint
|
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
@@ -62,11 +43,10 @@ linters:
|
|||||||
- dupl
|
- dupl
|
||||||
- dupword
|
- dupword
|
||||||
- durationcheck
|
- durationcheck
|
||||||
|
- err113
|
||||||
- errchkjson
|
- errchkjson
|
||||||
- errname
|
- errname
|
||||||
- execinquery
|
|
||||||
- exhaustive
|
- exhaustive
|
||||||
- exportloopref
|
|
||||||
- forcetypeassert
|
- forcetypeassert
|
||||||
- gci
|
- gci
|
||||||
- gocheckcompilerdirectives
|
- gocheckcompilerdirectives
|
||||||
@@ -77,10 +57,8 @@ linters:
|
|||||||
- gocritic
|
- gocritic
|
||||||
- gocyclo
|
- gocyclo
|
||||||
- godot
|
- godot
|
||||||
- goerr113
|
|
||||||
- goheader
|
- goheader
|
||||||
- goimports
|
- goimports
|
||||||
- gomnd
|
|
||||||
- gomoddirectives
|
- gomoddirectives
|
||||||
- goprintffuncname
|
- goprintffuncname
|
||||||
- gosec
|
- gosec
|
||||||
@@ -94,6 +72,7 @@ linters:
|
|||||||
- makezero
|
- makezero
|
||||||
- mirror
|
- mirror
|
||||||
- misspell
|
- misspell
|
||||||
|
- mnd
|
||||||
- musttag
|
- musttag
|
||||||
- nakedret
|
- nakedret
|
||||||
- nestif
|
- nestif
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ ARG ALPINE_VERSION=3.20
|
|||||||
ARG GO_ALPINE_VERSION=3.20
|
ARG GO_ALPINE_VERSION=3.20
|
||||||
ARG GO_VERSION=1.22
|
ARG GO_VERSION=1.22
|
||||||
ARG XCPUTRANSLATE_VERSION=v0.6.0
|
ARG XCPUTRANSLATE_VERSION=v0.6.0
|
||||||
ARG GOLANGCI_LINT_VERSION=v1.56.2
|
ARG GOLANGCI_LINT_VERSION=v1.61.0
|
||||||
ARG MOCKGEN_VERSION=v1.6.0
|
ARG MOCKGEN_VERSION=v1.6.0
|
||||||
ARG BUILDPLATFORM=linux/amd64
|
ARG BUILDPLATFORM=linux/amd64
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@@ -287,10 +288,13 @@ func _main(ctx context.Context, buildInfo models.BuildInformation,
|
|||||||
logger.Warn(warning)
|
logger.Warn(warning)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.MkdirAll("/tmp/gluetun", 0644); err != nil {
|
const permission = fs.FileMode(0644)
|
||||||
|
err = os.MkdirAll("/tmp/gluetun", permission)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := os.MkdirAll("/gluetun", 0644); err != nil {
|
err = os.MkdirAll("/gluetun", permission)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package alpine
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -39,7 +40,8 @@ func (a *Alpine) CreateUser(username string, uid int) (createdUsername string, e
|
|||||||
ErrUserAlreadyExists, username, u.Uid, uid)
|
ErrUserAlreadyExists, username, u.Uid, uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := os.OpenFile(a.passwdPath, os.O_APPEND|os.O_WRONLY, 0644)
|
const permission = fs.FileMode(0644)
|
||||||
|
file, err := os.OpenFile(a.passwdPath, os.O_APPEND|os.O_WRONLY, permission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -90,7 +91,8 @@ func (c *CLI) FormatServers(args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
output = filepath.Clean(output)
|
output = filepath.Clean(output)
|
||||||
file, err := os.OpenFile(output, os.O_TRUNC|os.O_WRONLY|os.O_CREATE, 0644)
|
const permission = fs.FileMode(0644)
|
||||||
|
file, err := os.OpenFile(output, os.O_TRUNC|os.O_WRONLY|os.O_CREATE, permission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("opening output file: %w", err)
|
return fmt.Errorf("opening output file: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func base58Encode(data []byte) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// integer simplification of ceil(log(256)/log(58))
|
// integer simplification of ceil(log(256)/log(58))
|
||||||
ceilLog256Div58 := (len(data)-zcount)*555/406 + 1 //nolint:gomnd
|
ceilLog256Div58 := (len(data)-zcount)*555/406 + 1 //nolint:mnd
|
||||||
size := zcount + ceilLog256Div58
|
size := zcount + ceilLog256Div58
|
||||||
|
|
||||||
output := make([]byte, size)
|
output := make([]byte, size)
|
||||||
@@ -43,7 +43,7 @@ func base58Encode(data []byte) string {
|
|||||||
for _, b := range data {
|
for _, b := range data {
|
||||||
i := size - 1
|
i := size - 1
|
||||||
for carry := uint32(b); i > high || carry != 0; i-- {
|
for carry := uint32(b); i > high || carry != 0; i-- {
|
||||||
carry += 256 * uint32(output[i]) //nolint:gomnd
|
carry += 256 * uint32(output[i]) //nolint:mnd
|
||||||
output[i] = byte(carry % radix)
|
output[i] = byte(carry % radix)
|
||||||
carry /= radix
|
carry /= radix
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package files
|
package files
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -77,7 +78,8 @@ PresharedKey = YJ680VN+dGrdsWNjSFqZ6vvwuiNhbq502ZL3G7Q3o3g=
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
configFile := filepath.Join(t.TempDir(), "wg.conf")
|
configFile := filepath.Join(t.TempDir(), "wg.conf")
|
||||||
err := os.WriteFile(configFile, []byte(testCase.fileContent), 0600)
|
const permission = fs.FileMode(0600)
|
||||||
|
err := os.WriteFile(configFile, []byte(testCase.fileContent), permission)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
wireguard, err := ParseWireguardConf(configFile)
|
wireguard, err := ParseWireguardConf(configFile)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package secrets
|
package secrets
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -38,7 +39,8 @@ func Test_Source_Get(t *testing.T) {
|
|||||||
"empty_secret_file": {
|
"empty_secret_file": {
|
||||||
makeSource: func(tempDir string) (source *Source, err error) {
|
makeSource: func(tempDir string) (source *Source, err error) {
|
||||||
secretFilepath := filepath.Join(tempDir, "test_file")
|
secretFilepath := filepath.Join(tempDir, "test_file")
|
||||||
err = os.WriteFile(secretFilepath, nil, os.ModePerm)
|
const permission = fs.FileMode(0600)
|
||||||
|
err = os.WriteFile(secretFilepath, nil, permission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -53,7 +55,8 @@ func Test_Source_Get(t *testing.T) {
|
|||||||
"default_secret_file": {
|
"default_secret_file": {
|
||||||
makeSource: func(tempDir string) (source *Source, err error) {
|
makeSource: func(tempDir string) (source *Source, err error) {
|
||||||
secretFilepath := filepath.Join(tempDir, "test_file")
|
secretFilepath := filepath.Join(tempDir, "test_file")
|
||||||
err = os.WriteFile(secretFilepath, []byte{'A'}, os.ModePerm)
|
const permission = fs.FileMode(0600)
|
||||||
|
err = os.WriteFile(secretFilepath, []byte{'A'}, permission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -69,7 +72,8 @@ func Test_Source_Get(t *testing.T) {
|
|||||||
"env_specified_secret_file": {
|
"env_specified_secret_file": {
|
||||||
makeSource: func(tempDir string) (source *Source, err error) {
|
makeSource: func(tempDir string) (source *Source, err error) {
|
||||||
secretFilepath := filepath.Join(tempDir, "test_file_custom")
|
secretFilepath := filepath.Join(tempDir, "test_file_custom")
|
||||||
err = os.WriteFile(secretFilepath, []byte{'A'}, os.ModePerm)
|
const permission = fs.FileMode(0600)
|
||||||
|
err = os.WriteFile(secretFilepath, []byte{'A'}, permission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ func parseMetricSize(size string) (n uint64, err error) {
|
|||||||
return n, fmt.Errorf("%w: empty string", ErrMetricSizeMalformed)
|
return n, fmt.Errorf("%w: empty string", ErrMetricSizeMalformed)
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
multiplerLetterToValue := map[byte]uint64{
|
multiplerLetterToValue := map[byte]uint64{
|
||||||
'K': 1000,
|
'K': 1000,
|
||||||
'M': 1000000,
|
'M': 1000000,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (h *handler) isAuthorized(responseWriter http.ResponseWriter, request *http.Request) (authorized bool) {
|
func (h *handler) isAuthorized(responseWriter http.ResponseWriter, request *http.Request) (authorized bool) {
|
||||||
if h.username == "" || (request.Method != "CONNECT" && !request.URL.IsAbs()) {
|
if h.username == "" || (request.Method != http.MethodConnect && !request.URL.IsAbs()) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
basicAuth := request.Header.Get("Proxy-Authorization")
|
basicAuth := request.Header.Get("Proxy-Authorization")
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ func checkResponse(response []byte, expectedOperationCode byte,
|
|||||||
ErrResponseSizeTooSmall, minResponseSize, len(response))
|
ErrResponseSizeTooSmall, minResponseSize, len(response))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(response) != int(expectedResponseSize) {
|
if uint(len(response)) != expectedResponseSize {
|
||||||
return fmt.Errorf("%w: expected %d bytes and got %d byte(s)",
|
return fmt.Errorf("%w: expected %d bytes and got %d byte(s)",
|
||||||
ErrResponseSizeUnexpected, expectedResponseSize, len(response))
|
ErrResponseSizeUnexpected, expectedResponseSize, len(response))
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ var (
|
|||||||
// if the result code is not a success (0).
|
// if the result code is not a success (0).
|
||||||
// See https://www.ietf.org/rfc/rfc6886.html#section-3.5
|
// See https://www.ietf.org/rfc/rfc6886.html#section-3.5
|
||||||
//
|
//
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
func checkResultCode(resultCode uint16) (err error) {
|
func checkResultCode(resultCode uint16) (err error) {
|
||||||
switch resultCode {
|
switch resultCode {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ func Test_Client_ExternalAddress(t *testing.T) {
|
|||||||
remoteAddress := launchUDPServer(t, testCase.exchanges)
|
remoteAddress := launchUDPServer(t, testCase.exchanges)
|
||||||
|
|
||||||
client := Client{
|
client := Client{
|
||||||
serverPort: uint16(remoteAddress.Port),
|
serverPort: uint16(remoteAddress.Port), //nolint:gosec
|
||||||
initialConnectionDuration: testCase.initialConnDuration,
|
initialConnectionDuration: testCase.initialConnDuration,
|
||||||
maxRetries: 1,
|
maxRetries: 1,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ func Test_Client_AddPortMapping(t *testing.T) {
|
|||||||
remoteAddress := launchUDPServer(t, testCase.exchanges)
|
remoteAddress := launchUDPServer(t, testCase.exchanges)
|
||||||
|
|
||||||
client := Client{
|
client := Client{
|
||||||
serverPort: uint16(remoteAddress.Port),
|
serverPort: uint16(remoteAddress.Port), //nolint:gosec
|
||||||
initialConnectionDuration: testCase.initialConnectionDuration,
|
initialConnectionDuration: testCase.initialConnectionDuration,
|
||||||
maxRetries: 1,
|
maxRetries: 1,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ func Test_Client_rpc(t *testing.T) {
|
|||||||
remoteAddress := launchUDPServer(t, testCase.exchanges)
|
remoteAddress := launchUDPServer(t, testCase.exchanges)
|
||||||
|
|
||||||
client := Client{
|
client := Client{
|
||||||
serverPort: uint16(remoteAddress.Port),
|
serverPort: uint16(remoteAddress.Port), //nolint:gosec
|
||||||
initialConnectionDuration: testCase.initialConnectionDuration,
|
initialConnectionDuration: testCase.initialConnectionDuration,
|
||||||
maxRetries: 1,
|
maxRetries: 1,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ func netlinkLinkToLink(netlinkLink netlink.Link) Link {
|
|||||||
Name: attributes.Name,
|
Name: attributes.Name,
|
||||||
Index: attributes.Index,
|
Index: attributes.Index,
|
||||||
EncapType: attributes.EncapType,
|
EncapType: attributes.EncapType,
|
||||||
MTU: uint16(attributes.MTU),
|
MTU: uint16(attributes.MTU), //nolint:gosec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (c *Configurator) WriteConfig(lines []string) error {
|
func (c *Configurator) WriteConfig(lines []string) error {
|
||||||
file, err := os.OpenFile(c.configPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
|
const permission = 0644
|
||||||
|
file, err := os.OpenFile(c.configPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, permission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ var (
|
|||||||
|
|
||||||
func extractProto(line string) (protocol string, err error) {
|
func extractProto(line string) (protocol string, err error) {
|
||||||
fields := strings.Fields(line)
|
fields := strings.Fields(line)
|
||||||
if len(fields) != 2 { //nolint:gomnd
|
if len(fields) != 2 { //nolint:mnd
|
||||||
return "", fmt.Errorf("%w: %s", errProtoLineFieldsCount, line)
|
return "", fmt.Errorf("%w: %s", errProtoLineFieldsCount, line)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ func extractRemote(line string) (ip netip.Addr, port uint16,
|
|||||||
// the firewall before the VPN is up.
|
// the firewall before the VPN is up.
|
||||||
}
|
}
|
||||||
|
|
||||||
if n > 2 { //nolint:gomnd
|
if n > 2 { //nolint:mnd
|
||||||
portInt, err := strconv.Atoi(fields[2])
|
portInt, err := strconv.Atoi(fields[2])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return netip.Addr{}, 0, "", fmt.Errorf("%w: %s", errPortNotValid, line)
|
return netip.Addr{}, 0, "", fmt.Errorf("%w: %s", errPortNotValid, line)
|
||||||
@@ -134,7 +134,7 @@ func extractRemote(line string) (ip netip.Addr, port uint16,
|
|||||||
port = uint16(portInt)
|
port = uint16(portInt)
|
||||||
}
|
}
|
||||||
|
|
||||||
if n > 3 { //nolint:gomnd
|
if n > 3 { //nolint:mnd
|
||||||
switch fields[3] {
|
switch fields[3] {
|
||||||
case "tcp", "udp":
|
case "tcp", "udp":
|
||||||
protocol = fields[3]
|
protocol = fields[3]
|
||||||
|
|||||||
@@ -75,6 +75,6 @@ That error usually happens because either:
|
|||||||
level = levelWarn
|
level = levelWarn
|
||||||
}
|
}
|
||||||
|
|
||||||
filtered = constants.ColorOpenvpn().Sprintf(filtered)
|
filtered = constants.ColorOpenvpn().Sprint(filtered)
|
||||||
return filtered, level
|
return filtered, level
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func (c cipherDESCBC) IVSize() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c cipherDESCBC) KeySize() int {
|
func (c cipherDESCBC) KeySize() int {
|
||||||
return 8 //nolint:gomnd
|
return 8 //nolint:mnd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c cipherDESCBC) OID() asn1.ObjectIdentifier {
|
func (c cipherDESCBC) OID() asn1.ObjectIdentifier {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(443, 1194, 1637) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 1194, 1637) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(443, 443, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 443, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
RemoteCertTLS: true,
|
RemoteCertTLS: true,
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Support
|
|||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
// TODO: Set the default ports for each VPN protocol+network protocol
|
// TODO: Set the default ports for each VPN protocol+network protocol
|
||||||
// combination. If one combination is not supported, set it to `0`.
|
// combination. If one combination is not supported, set it to `0`.
|
||||||
defaults := utils.NewConnectionDefaults(443, 1194, 51820) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 1194, 51820) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ func (p *Provider) OpenVPNConfig(connection models.Connection,
|
|||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
// TODO: Set the necessary fields in `providerSettings` to
|
// TODO: Set the necessary fields in `providerSettings` to
|
||||||
// generate the right OpenVPN configuration file.
|
// generate the right OpenVPN configuration file.
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
Ciphers: []string{
|
Ciphers: []string{
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ func (u *Updater) FetchServers(ctx context.Context, minServers int) (
|
|||||||
common.ErrNotEnoughServers, len(servers), minServers)
|
common.ErrNotEnoughServers, len(servers), minServers)
|
||||||
}
|
}
|
||||||
|
|
||||||
maxServers := 2 * len(data.Servers) //nolint:gomnd
|
maxServers := 2 * len(data.Servers) //nolint:mnd
|
||||||
servers = make([]models.Server, 0, maxServers)
|
servers = make([]models.Server, 0, maxServers)
|
||||||
for _, serverData := range data.Servers {
|
for _, serverData := range data.Servers {
|
||||||
baseServer := models.Server{
|
baseServer := models.Server{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(0, 1195, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(0, 1195, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
RemoteCertTLS: true,
|
RemoteCertTLS: true,
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(4443, 4443, 51820) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(4443, 4443, 51820) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
Ciphers: []string{
|
Ciphers: []string{
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ func (hts hostToServerData) adaptWithIPs(hostToIPs map[string][]netip.Addr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (hts hostToServerData) toServersSlice() (servers []models.Server) {
|
func (hts hostToServerData) toServersSlice() (servers []models.Server) {
|
||||||
servers = make([]models.Server, 0, 2*len(hts)) //nolint:gomnd
|
servers = make([]models.Server, 0, 2*len(hts)) //nolint:mnd
|
||||||
for hostname, serverData := range hts {
|
for hostname, serverData := range hts {
|
||||||
baseServer := models.Server{
|
baseServer := models.Server{
|
||||||
Hostname: hostname,
|
Hostname: hostname,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(0, 443, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(0, 443, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
RemoteCertTLS: true,
|
RemoteCertTLS: true,
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(8080, 553, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(8080, 553, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
Ciphers: []string{
|
Ciphers: []string{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func parseOpenvpnURL(url, protocol string) (country, region, city string) {
|
|||||||
case 1:
|
case 1:
|
||||||
country = parts[0]
|
country = parts[0]
|
||||||
return country, "", ""
|
return country, "", ""
|
||||||
case 2: //nolint:gomnd
|
case 2: //nolint:mnd
|
||||||
country = parts[0]
|
country = parts[0]
|
||||||
city = parts[1]
|
city = parts[1]
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(0, 443, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(0, 443, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(443, 1194, 58237) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 1194, 58237) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
Ciphers: []string{
|
Ciphers: []string{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(443, 1194, 51820) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 1194, 51820) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
Ciphers: []string{
|
Ciphers: []string{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(443, 1194, 51820) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 1194, 51820) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
Ciphers: []string{
|
Ciphers: []string{
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type serverData struct {
|
|||||||
// IPv6Station is mostly empty, so we ignore it for now.
|
// IPv6Station is mostly empty, so we ignore it for now.
|
||||||
IPv6Station netip.Addr `json:"station_ipv6"`
|
IPv6Station netip.Addr `json:"station_ipv6"`
|
||||||
// Hostname is the server hostname, for example 'pl128.nordvpn.com'
|
// Hostname is the server hostname, for example 'pl128.nordvpn.com'
|
||||||
Hostname string
|
Hostname string `json:"hostname"`
|
||||||
// Status is the server status, for example 'online'
|
// Status is the server status, for example 'online'
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
// Locations is the list of location IDs for the server.
|
// Locations is the list of location IDs for the server.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(443, 443, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 443, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
Ciphers: []string{
|
Ciphers: []string{
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func internalIPToPorts(internalIP netip.Addr) (ports []uint16) {
|
|||||||
last16Bits[0] & 0b00001111, // only keep 4 bits
|
last16Bits[0] & 0b00001111, // only keep 4 bits
|
||||||
last16Bits[1],
|
last16Bits[1],
|
||||||
}
|
}
|
||||||
basePort := uint16(last12Bits[0])<<8 + uint16(last12Bits[1]) //nolint:gomnd
|
basePort := uint16(last12Bits[0])<<8 + uint16(last12Bits[1]) //nolint:mnd
|
||||||
return []uint16{
|
return []uint16{
|
||||||
10000 + basePort,
|
10000 + basePort,
|
||||||
20000 + basePort,
|
20000 + basePort,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(0, 1194, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(0, 1194, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
Ciphers: []string{
|
Ciphers: []string{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func newHTTPClient(serverName string) (client *http.Client, err error) {
|
|||||||
panic("cannot load custom PIA certificate")
|
panic("cannot load custom PIA certificate")
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
return &http.Client{
|
return &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
// Settings taken from http.DefaultTransport
|
// Settings taken from http.DefaultTransport
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
@@ -202,7 +203,8 @@ func readPIAPortForwardData(portForwardPath string) (data piaPortForwardData, er
|
|||||||
}
|
}
|
||||||
|
|
||||||
func writePIAPortForwardData(portForwardPath string, data piaPortForwardData) (err error) {
|
func writePIAPortForwardData(portForwardPath string, data piaPortForwardData) (err error) {
|
||||||
file, err := os.OpenFile(portForwardPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
|
const permission = fs.FileMode(0644)
|
||||||
|
file, err := os.OpenFile(portForwardPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, permission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(443, 1194, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 1194, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(443, 1194, 51820) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 1194, 51820) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
RemoteCertTLS: true,
|
RemoteCertTLS: true,
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(80, 53, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(80, 53, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ func (p *Provider) OpenVPNConfig(connection models.Connection,
|
|||||||
openvpn.AES256gcm,
|
openvpn.AES256gcm,
|
||||||
},
|
},
|
||||||
KeyDirection: "1",
|
KeyDirection: "1",
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
Ping: 10,
|
Ping: 10,
|
||||||
CAs: []string{"MIIE6DCCA9CgAwIBAgIJAMjXFoeo5uSlMA0GCSqGSIb3DQEBCwUAMIGoMQswCQYDVQQGEwJISzEQMA4GA1UECBMHQ2VudHJhbDELMAkGA1UEBxMCSEsxGDAWBgNVBAoTD1NlY3VyZS1TZXJ2ZXJDQTELMAkGA1UECxMCSVQxGDAWBgNVBAMTD1NlY3VyZS1TZXJ2ZXJDQTEYMBYGA1UEKRMPU2VjdXJlLVNlcnZlckNBMR8wHQYJKoZIhvcNAQkBFhBtYWlsQGhvc3QuZG9tYWluMB4XDTE2MDExNTE1MzQwOVoXDTI2MDExMjE1MzQwOVowgagxCzAJBgNVBAYTAkhLMRAwDgYDVQQIEwdDZW50cmFsMQswCQYDVQQHEwJISzEYMBYGA1UEChMPU2VjdXJlLVNlcnZlckNBMQswCQYDVQQLEwJJVDEYMBYGA1UEAxMPU2VjdXJlLVNlcnZlckNBMRgwFgYDVQQpEw9TZWN1cmUtU2VydmVyQ0ExHzAdBgkqhkiG9w0BCQEWEG1haWxAaG9zdC5kb21haW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDluufhyLlyv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JBgNVBAYTAkhLMRAwDgYDVQQIEwdDZW50cmFsMQswCQYDVQQHEwJISzEYMBYGA1UEChMPU2VjdXJlLVNlcnZlckNBMQswCQYDVQQLEwJJVDEYMBYGA1UEAxMPU2VjdXJlLVNlcnZlckNBMRgwFgYDVQQpEw9TZWN1cmUtU2VydmVyQ0ExHzAdBgkqhkiG9w0BCQEWEG1haWxAaG9zdC5kb21haW6CCQDI1xaHqObkpTATBgNVHSUEDDAKBggrBgEFBQcDAjALBgNVHQ8EBAMCB4AwDQYJKoZIhvcNAQELBQADggEBAFyFo2VUX/UFixsdPdK9/Yt6mkCWc+XS1xbapGXXb9U1d+h1iBCIV9odUHgNCXWpz1hR5Uu/OCzaZ0asLE4IFMZlQmJs8sMT0c1tfPPGW45vxbL0lhqnQ8PNcBH7huNK7VFjUh4szXRKmaQPaM4S91R3L4CaNfVeHfAg7mN2m9Zn5Gto1Q1/CFMGKu2hxwGEw5p+X1czBWEvg/O09ckx/ggkkI1NcZsNiYQ+6Pz8DdGGX3+05YwLZu94+O6iIMrzxl/il0eK83g3YPbsOrASARvw6w/8sOnJCK5eOacl21oww875KisnYdWjHB1FiI+VzQ1/gyoDsL5kPTJVuu2CoG8=", //nolint:lll
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(443, 443, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 443, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(), p.storage, selection, defaults, ipv6Supported, p.randSource)
|
return utils.GetConnection(p.Name(), p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(1443, 1194, 51820) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(1443, 1194, 51820) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
RemoteCertTLS: true,
|
RemoteCertTLS: true,
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(1912, 1912, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(1912, 1912, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func (p *Provider) OpenVPNConfig(connection models.Connection,
|
|||||||
openvpn.AES128cbc, // For OpenVPN 2.5, see https://github.com/qdm12/gluetun/issues/2271#issuecomment-2103349935
|
openvpn.AES128cbc, // For OpenVPN 2.5, see https://github.com/qdm12/gluetun/issues/2271#issuecomment-2103349935
|
||||||
},
|
},
|
||||||
Auth: openvpn.SHA256,
|
Auth: openvpn.SHA256,
|
||||||
TunMTUExtra: 32, //nolint:gomnd
|
TunMTUExtra: 32, //nolint:mnd
|
||||||
KeyDirection: "1",
|
KeyDirection: "1",
|
||||||
CAs: []string{
|
CAs: []string{
|
||||||
"MIIDMTCCAhmgAwIBAgIJAKnGGJK6qLqSMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNVBAMMCVRHLVZQTi1DQTAgFw0xOTA1MjExNDIzMTFaGA8yMDU5MDUxMTE0MjMxMVowFDESMBAGA1UEAwwJVEctVlBOLUNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlv0UgPD3xVAvhhP6q1HCmeAWbH+9HPkyQ2P6qM5oHY5dntjmq8YT48FZGHWv7+s9O47v6Bv7rEc4UwQx15cc2LByivX2JwmE8JACvNfwEnZXYAPq9WU3ZgRrAGvA09ItuLqK2fQ4A7h8bFhmyxCbSzP1sSIT/zJY6ebuh5rDQSMJRMaoI0t1zorEZ7PlEmh+o0w5GPs0D0vY50UcnEzB4GOdWC9pJREwEqppWYLN7RRdG8JyIqmA59mhARCnQFUo38HWic4trxFe71jtD7YInNV7ShQtg0S0sXo36Rqfz72Jo08qqI70dNs5DN1aGNkQ/tRK9DhL5DLmTkaCw7mEFQIDAQABo4GDMIGAMB0GA1UdDgQWBBR7DcymXBp6u/jAaZOPUjUhEyhXfjBEBgNVHSMEPTA7gBR7DcymXBp6u/jAaZOPUjUhEyhXfqEYpBYwFDESMBAGA1UEAwwJVEctVlBOLUNBggkAqcYYkrqoupIwDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQELBQAD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BAUwAwEB/zALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQELBQADggEBAE79ngbdSlP7IBbfnJ+2Ju7vqt9/GyhcsYtjibp6gsMUxKlD8HuvlSGj5kNO5wiwN7XXqsjYtJfdhmzzVbXksi8Fnbnfa8GhFl4IAjLJ5cxaWOxjr6wx2AhIs+BVVARjaU7iTK91RXJnl6u7UDHTkQylBTl7wgpMeG6GjhaHfcOL1t7D2w8x23cTO+p+n53P3cBq+9TiAUORdzXJvbCxlPMDSDArsgBjC57W7dtdnZo7gTfQG77JTDFBeSwPwLF7PjBB4S6rzU/4fcYwy83XKP6zDn9tgUJDnpFb/7jJ/PbNkK4BWYJp3XytOtt66v9SEKw+v/fJ+VkjU16vE/9Q3h4=", //nolint:lll
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(110, 1282, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(110, 1282, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
RemoteCertTLS: true,
|
RemoteCertTLS: true,
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(1197, 1197, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(1197, 1197, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func (p *Provider) OpenVPNConfig(connection models.Connection,
|
|||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
RemoteCertTLS: true,
|
RemoteCertTLS: true,
|
||||||
AuthUserPass: false,
|
AuthUserPass: false,
|
||||||
Ping: 5, //nolint:gomnd
|
Ping: 5, //nolint:mnd
|
||||||
RenegDisabled: true,
|
RenegDisabled: true,
|
||||||
Ciphers: []string{openvpn.AES256cbc},
|
Ciphers: []string{openvpn.AES256cbc},
|
||||||
Auth: openvpn.SHA512,
|
Auth: openvpn.SHA512,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(0, 443, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(0, 443, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
func (p *Provider) OpenVPNConfig(connection models.Connection,
|
||||||
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
settings settings.OpenVPN, ipv6Supported bool) (lines []string) {
|
||||||
//nolint:gomnd
|
//nolint:mnd
|
||||||
providerSettings := utils.OpenVPNProviderSettings{
|
providerSettings := utils.OpenVPNProviderSettings{
|
||||||
RemoteCertTLS: true,
|
RemoteCertTLS: true,
|
||||||
AuthUserPass: true,
|
AuthUserPass: true,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(1195, 1194, 0) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(1195, 1194, 0) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ func (p *Provider) OpenVPNConfig(connection models.Connection,
|
|||||||
openvpn.AES256gcm,
|
openvpn.AES256gcm,
|
||||||
},
|
},
|
||||||
Auth: openvpn.SHA512,
|
Auth: openvpn.SHA512,
|
||||||
Ping: 30, //nolint:gomnd
|
Ping: 30, //nolint:mnd
|
||||||
RenegDisabled: true,
|
RenegDisabled: true,
|
||||||
CAs: []string{"MIIDQjCCAiqgAwIBAgIUPppqnRZfvGGrT4GjXFE4Q29QzgowDQYJKoZIhvcNA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7nTfagkVdWy7x/av361UD4t9fv1j4YYTh4XLRp7KVXs6AGZ7T1hqPYFMUIoPpFhPzFxH4euJjfazr4SkTR6k6Vhw3pyFd6HP65vcqpzHGxFytSa8HtltBk2DpzIf8yV9TEy+gOXFaaGss0YKQ5OU1ieqZRuLVEGiu17lByYiQGyemIETJbdkyiSg93dDJRxjaTk7c8CEdpipt07ndSIPldMtXA=", //nolint:lll
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
func (p *Provider) GetConnection(selection settings.ServerSelection, ipv6Supported bool) (
|
||||||
connection models.Connection, err error) {
|
connection models.Connection, err error) {
|
||||||
defaults := utils.NewConnectionDefaults(443, 1194, 1194) //nolint:gomnd
|
defaults := utils.NewConnectionDefaults(443, 1194, 1194) //nolint:mnd
|
||||||
return utils.GetConnection(p.Name(),
|
return utils.GetConnection(p.Name(),
|
||||||
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
p.storage, selection, defaults, ipv6Supported, p.randSource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func (p *Provider) OpenVPNConfig(connection models.Connection,
|
|||||||
openvpn.AES128gcm,
|
openvpn.AES128gcm,
|
||||||
},
|
},
|
||||||
Auth: openvpn.SHA512,
|
Auth: openvpn.SHA512,
|
||||||
Ping: 10, //nolint:gomnd
|
Ping: 10, //nolint:mnd
|
||||||
VerifyX509Type: "name",
|
VerifyX509Type: "name",
|
||||||
KeyDirection: "1",
|
KeyDirection: "1",
|
||||||
RenegDisabled: true,
|
RenegDisabled: true,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ func (u *Updater) FetchServers(ctx context.Context, minServers int) (
|
|||||||
x5090Name := group.OvpnX509
|
x5090Name := group.OvpnX509
|
||||||
wgPubKey := group.WgPubKey
|
wgPubKey := group.WgPubKey
|
||||||
for _, node := range group.Nodes {
|
for _, node := range group.Nodes {
|
||||||
ips := make([]netip.Addr, 0, 2) //nolint:gomnd
|
ips := make([]netip.Addr, 0, 2) //nolint:mnd
|
||||||
if node.IP.IsValid() {
|
if node.IP.IsValid() {
|
||||||
ips = append(ips, node.IP)
|
ips = append(ips, node.IP)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package publicip
|
package publicip
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func persistPublicIP(path string, content string, puid, pgid int) error {
|
func persistPublicIP(path string, content string, puid, pgid int) error {
|
||||||
file, err := os.OpenFile(path, os.O_TRUNC|os.O_WRONLY|os.O_CREATE, 0644)
|
const permission = fs.FileMode(0644)
|
||||||
|
file, err := os.OpenFile(path, os.O_TRUNC|os.O_WRONLY|os.O_CREATE, permission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ func New(settings Settings, debugLogger DebugLogger) (
|
|||||||
return nil, fmt.Errorf("converting settings to lookup maps: %w", err)
|
return nil, fmt.Errorf("converting settings to lookup maps: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:goconst
|
|
||||||
return func(handler http.Handler) http.Handler {
|
return func(handler http.Handler) http.Handler {
|
||||||
return &authHandler{
|
return &authHandler{
|
||||||
childHandler: handler,
|
childHandler: handler,
|
||||||
|
|||||||
@@ -21,12 +21,13 @@ func (s *Storage) FlushToFile(path string) error {
|
|||||||
// flushToFile flushes the merged servers data to the file
|
// flushToFile flushes the merged servers data to the file
|
||||||
// specified by path, as indented JSON. It is not thread-safe.
|
// specified by path, as indented JSON. It is not thread-safe.
|
||||||
func (s *Storage) flushToFile(path string) error {
|
func (s *Storage) flushToFile(path string) error {
|
||||||
|
const permission = 0644
|
||||||
dirPath := filepath.Dir(path)
|
dirPath := filepath.Dir(path)
|
||||||
if err := os.MkdirAll(dirPath, 0644); err != nil {
|
if err := os.MkdirAll(dirPath, permission); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
|
file, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, permission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package tun
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
@@ -11,9 +12,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Create creates a TUN device at the path specified.
|
// Create creates a TUN device at the path specified.
|
||||||
func (t *Tun) Create(path string) error {
|
func (t *Tun) Create(path string) (err error) {
|
||||||
parentDir := filepath.Dir(path)
|
parentDir := filepath.Dir(path)
|
||||||
if err := os.MkdirAll(parentDir, 0751); err != nil {
|
err = os.MkdirAll(parentDir, 0751) //nolint:mnd
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +24,10 @@ func (t *Tun) Create(path string) error {
|
|||||||
minor = 200
|
minor = 200
|
||||||
)
|
)
|
||||||
dev := unix.Mkdev(major, minor)
|
dev := unix.Mkdev(major, minor)
|
||||||
err := unix.Mknod(path, unix.S_IFCHR, int(dev))
|
if dev > math.MaxInt {
|
||||||
|
panic("dev is too high")
|
||||||
|
}
|
||||||
|
err = unix.Mknod(path, unix.S_IFCHR, int(dev))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("creating TUN device file node: %w", err)
|
return fmt.Errorf("creating TUN device file node: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type githubCommit struct {
|
|||||||
Committer struct {
|
Committer struct {
|
||||||
Date time.Time `json:"date"`
|
Date time.Time `json:"date"`
|
||||||
} `json:"committer"`
|
} `json:"committer"`
|
||||||
}
|
} `json:"commit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var errHTTPStatusCode = errors.New("bad response HTTP status code")
|
var errHTTPStatusCode = errors.New("bad response HTTP status code")
|
||||||
|
|||||||
Reference in New Issue
Block a user