v3.21.0

passteque/gluetunv3.21.0Jul 28, 2021by qdm12

AI Summary

Updates all server data, adds configuration for OpenVPN flags and health timeouts, and refactors server storage to use embedded JSON. Updates dependencies and CI workflows.

Key Highlights

  • Hardcoded server data as immutable embedded JSON
  • New `OPENVPN_FLAGS` variable
  • Health timeout configuration variables
  • Updater CLI update with `-all` flag

Breaking Changes

  • Updater CLI flag changes: `-enduser` replaces `-file`, `-maintainer` replaces `-stdout`

New Features

  • Embedded server data
  • OpenVPN flags configuration
  • Health timeout configuration
  • Updater CLI update

Full Release Notes

## Fixes

- PrivateVPN: replace special last accented a character with `a` for `Bogota`
- Do not write out servers data and updated timestamp if no change was detected
- (@TJJP) Fix: Windscribe Openvpn config (#528)
  - See [blog.windscribe.com/openvpn-security-improvements-and-changes-7b04](https://blog.windscribe.com/openvpn-security-improvements-and-changes-7b04)
- Server data model version diff:
  - comparison fixed
  - missing "behind" suffix to log line
- Openvpn loop: possible deadlock: unlock read mutex for `GetSettingsAndServers`
- Alpine vulnerability fixed with apk-tools upgraded (except for `ppc64le` architecture)

## Features

- Update all servers for all providers
- Specify Openvpn flags with `OPENVPN_FLAGS`
- Set health timeouts with `HEALTH_OPENVPN_DURATION_INITIAL` and `HEALTH_OPENVPN_DURATION_ADDITION`
- Health server listening address configurable with `HEALTH_SERVER_ADDRESS`
- Updater CLI: add `-all` flag to update all VPN servers

## Breaking changes

- Updater CLI:
  - `-enduser` instead of `-file`
  - `-maintainer` instead of `-stdout`

## Documentation

## Maintenance

### Dependencies

- Upgrade `inet.af/netaddr` to `2021-07-18`
- Upgrade `qdm12/dns` to `v1.11.0`

### CI

- Remove microbadger hook from CI
- Rename `.github/workflows/build.yml` to `.github/workflows/ci.yml` for linting
- Bump `docker/build-push-action` from `2.4.0` to `2.6.1`
- Use curly braces around `BUILDPLATFORM`
- Rename `BUILD_DATE` to `CREATED`
- Build all images fully in parallel (thanks to JSON server information using less memory at compile time)

### Code

- Hardcoded servers data as a JSON embedded file in `internal/constants/servers.json`
  - use `embed.FS` to have immutable data
  - use `sync.Once` to parse JSON data only once without data races
- Remove debug line in health server
- Improve health code
- Use `qdm12/gosplash` for initial logs
- Upgrade `qdm12/golibs` and rework env error wrapping
- Do not mock os functions
  - Use filepaths with /tmp for tests instead
  - Only mock functions where filepath can't be specified such as user.Lookup
- Pass only single strings to logger methods
  - Do not assume formatting from logger's interface
  - Allow to change golibs in the future to accept only strings for logger methods
- Prefer empty string comparisons than `len(s) == 0`
- Firewall and routing use `logger.Debug` instead of `fmt.Println`
- Remove `SetVerbose` and `SetDebug` methods from firewall and routing
- Log routing teardown
- Default logging level set to info
- Inject `command.Cmder` to openvpn and firewall
- Pass network values to firewall constructor
- Move duration formatting to `qdm12/golibs/format`
- `internal/loopstate` package to manage the state of run loops
- Remove routing's `Configurator` from firewall's `Configurator`
- Remove routing's `Configurator` from openvpn's `Configurator`
- Common no custom port forwarding obtention implementation for all providers but PIA

### Packages rework:

- Constructors return concrete structs
- Constructors and struct fields accept narrow interfaces
- Split interfaces in sub-interfaces
- Split Go files in more smaller Go files
- Add interface compilation checks
- Use `internal/loopstate` to manage the state of their Run loop
- Add subpackage `state` to manage the state of the loop thread safely
- Packages reworked:
  - `internal/alpine`
  - `internal/cli`
  - `internal/dns`
  - `internal/firewall`
  - `internal/healthcheck`
  - `internal/httpproxy`
  - `internal/openvpn` (both loop and configurator)
  - `internal/publicip`
  - `internal/routing`