Quentin McGaw
2388e0550b
hotfix(publicip): return an error if trying to use cloudflare as ip provider for updating servers data
2024-10-11 21:57:25 +00:00
Quentin McGaw
a7d70dd9a3
fix(publicip): lock settings during entire update
...
- to prevent race conditions when data is cleared when vpn goes down
2024-10-11 21:24:18 +00:00
Quentin McGaw
76a4bb5dc3
chore: use gofumpt for code formatting
2024-10-11 19:27:29 +00:00
Quentin McGaw
abe9dcbe33
chore(lint): add new linters and update codebase
...
- add canonicalheader
- add copyloopvar
- add fatcontext
- add intrange
2024-10-11 18:28:00 +00:00
Quentin McGaw
3c8e80a1a4
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`
2024-10-11 18:05:54 +00:00
Quentin McGaw
5b2923ca65
feat(publicip): add ifconfigco option
2024-10-08 19:03:10 +00:00
Quentin McGaw
03deb9aed0
feat(publicip): PUBLICIP_ENABLED replaces PUBLICIP_PERIOD
...
- No point periodically fetch the public IP address. Could not find anything mentioning why this was added.
- Simplification of the publicip loop code
- `PUBLICIP_ENABLED` (on, off) can be set to enable or not public ip data fetching on VPN connection
- `PUBLICIP_PERIOD=0` still works to indicate to disable public ip fetching
- `PUBLICIP_PERIOD` != 0 means to enable public ip fetching
- Warnings logged when using `PUBLICIP_PERIOD`
2024-10-08 11:30:31 +00:00
Jeremy Lin
cbdd1a933c
feat(publicip): cloudflare API support ( #2502 )
2024-10-06 15:30:33 +02:00
Quentin McGaw
4218dba177
fix(publicip): abort ip data fetch if vpn context is canceled
...
- Prevents requesting the public IP address N times after N VPN failures
- Fetching runs with a context local to the 'single run'
- Single run writes single run result to a channel back to the caller, RunOnce is now blocking
2024-05-18 18:06:01 +00:00
wanshuangcheng
5dacbb994f
chore(all): fix typos in code comments ( #2216 )
2024-05-02 09:24:49 +02:00
Quentin McGaw
8454123cae
fix(publicip/api): ip2location parsing for latitude and longitude
2024-03-29 14:54:45 +00:00
Quentin McGaw
423a5c37e0
feat(publicip): PUBLICIP_API variable supporting ipinfo and ip2location
2024-02-14 07:36:45 +00:00
Quentin McGaw
cfca026621
chore(publicip): less coupling with ipinfo.io
2024-02-14 07:30:02 +00:00
Quentin McGaw
6a6337b98f
feat(publicip/ipinfo): add PUBLICIP_API_TOKEN variable
2024-02-13 10:55:06 +00:00
Quentin McGaw
6c639fcf7f
fix(publicip): do not retry on too many requests
2023-10-07 12:59:43 +00:00
Quentin McGaw
f96448947f
fix(publicip): rework run loop and fix restarts
...
- Clearing IP data on VPN disconnection clears file
- More efficient partial updates
- Fix loop exit
- Validate settings before updating
2023-09-24 14:55:51 +00:00
Aleksa Siriški
3449e7a0e1
fix(publicip): IPv6 endpoint for ipinfo ( #1853 )
2023-09-13 16:37:39 +02:00
Quentin McGaw
0a29337c3b
chore(all): replace net.IP with netip.Addr
2023-05-20 20:06:12 +00:00
Quentin McGaw
723d0f5e12
chore(lint): upgrade from v1.51.2 to v1.52.2
2023-04-12 09:40:00 +00:00
Quentin McGaw
4ba159e483
chore(all): review error wrappings
...
- remove repetitive `cannot` and `failed` prefixes
- rename `unmarshaling` to `decoding`
2023-04-01 16:57:18 +00:00
Quentin McGaw
ac02a64d17
fix(ipinfo): handle 403 as too many requests
2022-10-28 10:35:29 +00:00
Quentin McGaw
9c80150e09
fix(publicip): no retry when too many requests to ipinfo.io
2022-10-28 10:35:09 +00:00
Quentin McGaw
037f19e852
hotfix(publicip): revert back JSON to public_ip
2022-06-26 18:08:11 +00:00
Quentin McGaw
bda6707685
chore(all): remove unexported interfaces
2022-06-12 01:15:14 +00:00
Quentin McGaw
89277828ac
chore(publicip): internal/publicip/ipinfo package
2022-06-12 01:11:22 +00:00
Quentin McGaw
83b4a3fe55
chore(publicip): refactoring
...
- Exported `Fetcher` interface
- Inject `Fetcher` to publicip loop and updaters
- Get public IP and information at the same time
- Only query ipinfo.io
- Make `MultiInfo` part of the `Fetch` object
2022-06-12 00:46:08 +00:00
Quentin McGaw
578ef768ab
chore(all): return concrete types, accept interfaces
...
- Remove exported interfaces unused locally
- Define interfaces to accept arguments
- Return concrete types, not interfaces
2022-06-11 01:34:30 +00:00
Quentin McGaw
920ad8b54b
chore(errors): review all errors in codebase
2022-02-20 02:58:16 +00:00
Quentin McGaw
7d824a5179
chore(settings): refactor settings processing ( #756 )
...
- Better settings tree structure logged using `qdm12/gotree`
- Read settings from environment variables, then files, then secret files
- Settings methods to default them, merge them and override them
- `DNS_PLAINTEXT_ADDRESS` default changed to `127.0.0.1` to use DoT. Warning added if set to something else.
- `HTTPPROXY_LISTENING_ADDRESS` instead of `HTTPPROXY_PORT` (with retro-compatibility)
2022-01-06 06:40:23 -05:00
Quentin McGaw (desktop)
e7c952cbf7
Maint: remove opendns.com due to bad x509 cert
2021-09-30 16:01:35 +00:00
Quentin McGaw (desktop)
cf95692b93
Maint: package local narrow Logger interfaces
2021-09-23 17:06:09 +00:00
Quentin McGaw (desktop)
d39201f9b3
Fix: public IP loop deadlock
2021-09-10 22:54:02 +00:00
Quentin McGaw (desktop)
6b6caa435f
Fix: clear IP data when VPN is stopped
2021-09-06 13:28:05 +00:00
Quentin McGaw (desktop)
f9cb71027c
Feat: location data at /v1/publicip/ip
2021-09-05 22:54:10 +00:00
Quentin McGaw (desktop)
b98f2456c0
Fix: deadlock for openvpn, dns and publicip loops
2021-07-27 14:12:22 +00:00
Quentin McGaw (desktop)
ab910403c6
Fix: public IP loop being stuck
2021-07-26 01:35:43 +00:00
Quentin McGaw (laptop)
8105437815
Maint: add missing interface compilation checks
2021-07-24 19:54:15 +00:00
Quentin McGaw (laptop)
7b20cec035
Maint: rename SettingsGetterSetter to SettingsGetSetter
2021-07-24 19:49:50 +00:00
Quentin McGaw (laptop)
8d512852a4
Maint: rework publicip package
...
- Use loopstate package
- Loop interface composition
- Return concrete struct from constructors
- Split into more files
- Add publicip/state package
2021-07-24 19:49:11 +00:00
Quentin McGaw (desktop)
3c44214d01
Maint: 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
2021-07-23 17:36:08 +00:00
Quentin McGaw (desktop)
21f4cf7ab5
Maint: 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
2021-07-23 16:06:19 +00:00
Quentin McGaw (desktop)
0ed738cd61
Maint: make all set status context aware
2021-07-16 00:49:59 +00:00
Quentin McGaw (desktop)
876563c492
Maintenance: improve error wrapping
2021-05-30 16:14:08 +00:00
Quentin McGaw (desktop)
be22c8547f
Maintenance: use io instead of ioutil if possible
2021-05-30 03:13:19 +00:00
Quentin McGaw
7d6763cde7
Maintenance: upgrade golibs (affects logger)
2021-05-14 14:07:16 +00:00
Quentin McGaw
cff5e693d2
Maintenance: shutdown order
...
- Order of threads to shutdown (control then tickers then health etc.)
- Rely on closing channels instead of waitgroups
- Move exit logs from each package to the shutdown package
2021-05-11 22:24:32 +00:00
Quentin McGaw
a7a5cca8dd
Maintenance: parallelize IP information fetch
2021-05-08 23:37:32 +00:00
Quentin McGaw
d9a70fd094
Maintenance: improve publicip with Result struct
2021-05-08 23:30:29 +00:00
Quentin McGaw
c54ee71e1d
Maintenance: new logging, shorter with less deps
2021-02-25 23:51:29 +00:00
Quentin McGaw
3deb65b529
Feature: log out country, region and city of IP
2021-02-08 00:01:14 +00:00