diff --git a/go.mod b/go.mod index 29e26ab3..97469ce8 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/fatih/color v1.9.0 github.com/golang/mock v1.4.4 github.com/kyokomi/emoji v2.2.4+incompatible - github.com/qdm12/golibs v0.0.0-20201024185935-092412448c2c + github.com/qdm12/golibs v0.0.0-20201025221346-fe352060c25a github.com/qdm12/ss-server v0.0.0-20200819124651-6428e626ee83 github.com/stretchr/testify v1.6.1 github.com/vishvananda/netlink v1.1.0 diff --git a/go.sum b/go.sum index 3161d4b3..8aaed7db 100644 --- a/go.sum +++ b/go.sum @@ -74,6 +74,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/qdm12/golibs v0.0.0-20201024185935-092412448c2c h1:9EQyDXbeapnPeMeO8Yq7PE6zqYPGkHp/qijNBBTU74c= github.com/qdm12/golibs v0.0.0-20201024185935-092412448c2c/go.mod h1:pikkTN7g7zRuuAnERwqW1yAFq6pYmxrxpjiwGvb0Ysc= +github.com/qdm12/golibs v0.0.0-20201025221346-fe352060c25a h1:v0zUA1FWeVkTEd9KyxfehbRVJeFGOqyMY6FHO/Q9ITU= +github.com/qdm12/golibs v0.0.0-20201025221346-fe352060c25a/go.mod h1:pikkTN7g7zRuuAnERwqW1yAFq6pYmxrxpjiwGvb0Ysc= github.com/qdm12/ss-server v0.0.0-20200819124651-6428e626ee83 h1:b7sNsgsKxH0mbl9L1hdUp5KSDkZ/1kOQ+iHiBVgFElM= github.com/qdm12/ss-server v0.0.0-20200819124651-6428e626ee83/go.mod h1:ABVUkxubboL3vqBkOwDV9glX1/x7SnYrckBe5d+M/zw= github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg= diff --git a/internal/params/params.go b/internal/params/params.go index 369579f1..345d25a7 100644 --- a/internal/params/params.go +++ b/internal/params/params.go @@ -159,3 +159,10 @@ func (r *reader) GetVPNSP() (vpnServiceProvider models.VPNProvider, err error) { func (r *reader) GetVersionInformation() (enabled bool, err error) { return r.envParams.GetOnOff("VERSION_INFORMATION", libparams.Default("on")) } + +func (r *reader) onRetroActive(oldKey, newKey string) { + r.logger.Warn( + "You are using the old environment variable %s, please consider changing it to %s", + oldKey, newKey, + ) +} diff --git a/internal/params/routing.go b/internal/params/routing.go index 9b21e475..d383cc35 100644 --- a/internal/params/routing.go +++ b/internal/params/routing.go @@ -4,13 +4,19 @@ import ( "fmt" "net" "strings" + + libparams "github.com/qdm12/golibs/params" ) // GetOutboundSubnets obtains the CIDR subnets from the comma separated list of the // environment variable FIREWALL_OUTBOUND_SUBNETS. func (r *reader) GetOutboundSubnets() (outboundSubnets []net.IPNet, err error) { const key = "FIREWALL_OUTBOUND_SUBNETS" - s, err := r.envParams.GetEnv(key) + retroOption := libparams.RetroKeys( + []string{"EXTRA_SUBNETS"}, + r.onRetroActive, + ) + s, err := r.envParams.GetEnv(key, retroOption) if err != nil { return nil, err } else if s == "" {