IP_STATUS_FILE and routing improvements (#130)
- Obtains VPN public IP address from routing table - Logs and writes VPN Public IP address to `/ip` as soon as VPN is up - Obtain port forward, logs it and writes it as soon as VPN is up - Routing fully refactored and tested - Routing reads from `/proc/net/route` - Routing mutates the routes using `ip route ...`
This commit is contained in:
@@ -4,14 +4,16 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/qdm12/private-internet-access-docker/internal/models"
|
||||
"github.com/qdm12/private-internet-access-docker/internal/params"
|
||||
)
|
||||
|
||||
// System contains settings to configure system related elements
|
||||
type System struct {
|
||||
UID int
|
||||
GID int
|
||||
Timezone string
|
||||
UID int
|
||||
GID int
|
||||
Timezone string
|
||||
IPStatusFilepath models.Filepath
|
||||
}
|
||||
|
||||
// GetSystemSettings obtains the System settings using the params functions
|
||||
@@ -28,6 +30,10 @@ func GetSystemSettings(params params.ParamsReader) (settings System, err error)
|
||||
if err != nil {
|
||||
return settings, err
|
||||
}
|
||||
settings.IPStatusFilepath, err = params.GetIPStatusFilepath()
|
||||
if err != nil {
|
||||
return settings, err
|
||||
}
|
||||
return settings, nil
|
||||
}
|
||||
|
||||
@@ -37,6 +43,7 @@ func (s *System) String() string {
|
||||
fmt.Sprintf("User ID: %d", s.UID),
|
||||
fmt.Sprintf("Group ID: %d", s.GID),
|
||||
fmt.Sprintf("Timezone: %s", s.Timezone),
|
||||
fmt.Sprintf("IP Status filepath: %s", s.IPStatusFilepath),
|
||||
}
|
||||
return strings.Join(settingsList, "\n|--")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user