Cuong Manh Le
85c95a6a3a
all: set timeout for re-bootstrapping
2023-03-10 09:25:29 +07:00
Cuong Manh Le
fa50cd4df4
all: another rework on discovering bootstrap IPs
...
Instead of re-query DNS record for upstream when re-bootstrapping, just
query all records on startup, then selecting the next bootstrap ip
depends on the current network stack.
2023-03-10 09:25:17 +07:00
Cuong Manh Le
018f6651c1
Fix wrong time precision in bootstrapping timeout
...
The timeout is in millisecond, not second.
2023-03-08 10:19:49 +07:00
Cuong Manh Le
1a40767cb7
Use upstream timeout when querying bootstrap IP
2023-03-08 10:16:56 +07:00
Cuong Manh Le
12512a60da
Always use first record from DNS response
2023-03-07 10:45:29 +07:00
Cuong Manh Le
b0114dfaeb
cmd/ctrld: make staticcheck happy
2023-03-07 10:28:49 +07:00
Cuong Manh Le
fb20d443c1
all: retry the request more agressively
...
For better recovery and dealing with network stack changes, this commit
change the request flow to:
failure of any kind -> recreate transport/re-bootstrap -> retry once
That would make ctrld recover from all scenarios in theory.
2023-03-07 10:25:48 +07:00
Cuong Manh Le
262dcb1dff
cmd/ctrld: check for ipv6 listen local
...
Since when the machine may not have external ipv6 capability, but still
can do ipv6 network on local network.
2023-03-07 10:25:48 +07:00
Cuong Manh Le
8b08cc8a6e
all: rework bootstrap IP discovering
...
At startup, ctrld gathers bootstrap IP information and use this
bootstrap IP for connecting to upstream. However, in case the network
stack changed, for example, dues to VPN connection, ctrld will still use
this old (maybe invalid) bootstrap IP for the current network stack.
This commit rework the discovering process, and re-initializing the
bootstrap IP if connecting to upstream failed.
2023-03-07 10:25:48 +07:00
Cuong Manh Le
930a5ad439
cmd/ctrld: only set ::1 as DNS server on Windows if ipv6 available
2023-03-07 10:25:48 +07:00
Cuong Manh Le
8852f60ccb
Add idle conn timeout for HTTP transport
...
Allowing the connection to be re-new once it becomes un-usable.
2023-03-07 10:25:48 +07:00
Cuong Manh Le
2e1b3f9d07
Upgrade golang.org/x/net to v0.7.0
...
For pulling CVE-2022-41723 fix.
2023-03-07 10:25:48 +07:00
Cuong Manh Le
6d3c82d38d
internal/dns: add debian/openresolv to linux manager
2023-02-27 21:50:06 +07:00
Cuong Manh Le
cad71997aa
cmd/ctrld: allocate new ip instead of port
...
So the alternative listener address can still be used as system
resolver.
2023-02-27 20:50:01 +07:00
Cuong Manh Le
82900eeca6
cmd/ctrld: move log file if existed on app start
...
Updates #59
2023-02-27 20:43:56 +07:00
Cuong Manh Le
84fca06c62
cmd/ctrld: implement allocate/deallocate ip on freebsd
...
Updates #56
2023-02-27 20:43:56 +07:00
Cuong Manh Le
64f2dcb25b
Fix parsing network service name on darwin
...
The network service name appears on the previous line, not the same line
with "Device" name.
Updates #57
2023-02-27 20:43:56 +07:00
Cuong Manh Le
4c2d21a8f8
all: add freebsd supports
...
This commit add support for ctrld to run on freebsd, supported platforms
are amd64/arm64/armv6/armv7,386.
Supporting freebsd also requires adding debian and openresolv resolvconf.
Updates #47
2023-02-27 20:43:56 +07:00
Cuong Manh Le
4172fc09d0
cmd/ctrld: add self check for better error message reported
...
After telling service manager to start ctrld, performing self check
status by sending DNS query to ctrld listener. So if ctrld could not
start for any reason, an error message will be reported to user instead
of simply telling service started.
Updates #56
2023-02-27 20:43:55 +07:00
Cuong Manh Le
d9b699501d
cmd/ctrld: merge proxy log to main log
...
There's no reason to separate those two loggers anymore, and making them
separated may lead to inconsistent logging behavior.
Updates #54
2023-02-27 20:13:44 +07:00
Cuong Manh Le
71b1b324db
cmd/ctrld: honor configPath when writing config file
...
Updates #58
2023-02-27 20:13:44 +07:00
Cuong Manh Le
35c890048b
cmd/ctrld: remove prefix main field
...
While at it, also make init logging with empty log path when running
start command.
Updates #55
2023-02-27 20:13:44 +07:00
Cuong Manh Le
bac6810956
cmd/ctrld: fix missing unmarshalling config without --cd
...
Otherwise, DNS won't be set in non-Linux systems.
Updates #54
2023-02-27 20:13:44 +07:00
Cuong Manh Le
997ec342e0
cmd/ctrld,internal/dns: support systemd-networkd dbus
...
For interface managed by systemd-networkd, systemd-resolved can not
reset DNS. To fix this, attempting to check before the run loop and set
the suitable manager for the system.
Updates #55
2023-02-27 20:13:44 +07:00
Cuong Manh Le
e385547461
internal/net: fix wrong address when testing network up
2023-02-27 20:13:44 +07:00
Cuong Manh Le
83b551fb2d
internal/controld: check if ipv4 is available before connect to API
...
Updates #53
2023-02-27 20:13:42 +07:00
Cuong Manh Le
45f827a2c5
internal/controld: connect to API using ipv4 only
...
Connecting to API using ipv6 sometimes hang at TLS handshake, using ipv4
only so we can fetch the config more reliably.
Fixed #53
2023-02-27 19:54:52 +07:00
Cuong Manh Le
3218b5fac1
Add quic-free binaries in build pipeline
...
Updates #51
2023-02-27 19:54:18 +07:00
Cuong Manh Le
df514d15a5
Update quic-go to v0.32.0
...
Updates #51
2023-02-27 19:51:39 +07:00
Cuong Manh Le
50b0e5a4b0
cmd/ctrld: use proper exit codes for status command
...
While at it, disable sort commands, so help output will be in order.
Updates #48
2023-02-27 19:50:28 +07:00
Yegor S
6428ac23a0
Merge pull request #20 from Control-D-Inc/upx
...
Add upx to goreleaser builds
2023-02-14 14:09:13 -05:00
Yegor S
790cb773e2
Merge pull request #17 from Control-D-Inc/readme-badge
...
Add some badges to README.md
2023-02-13 11:52:36 -05:00
Yegor S
9dab097268
Merge pull request #10 from GiddyGoatGaming/patch-1
...
ci.yml: bump checkout -> v3 and setup-go-faster -> 1.8.0
2023-02-13 11:51:06 -05:00
Cuong Manh Le
f13f61592c
Add upx to goreleaser builds
...
Reducing the size of the final binaries, except for darwin, where the
packed binaries failed to run.
2023-02-13 21:58:45 +07:00
Cuong Manh Le
2f42fc055d
Add some badges to README.md
2023-02-08 00:53:16 +07:00
Yegor S
a08b39be16
Merge pull request #16 from Control-D-Inc/remove-darwin-from-regular-release
...
Remove darwin from regular builds
v1.1.0
2023-02-07 12:36:18 -05:00
Cuong Manh Le
d73ece9d9e
Remove darwin from regular builds
...
PR #13 add notarizing step for darwin, but forgot to remove darwin from
regular OS builds.
2023-02-08 00:21:15 +07:00
Yegor S
be6e2cc0a2
Merge pull request #14 from Control-D-Inc/cuonglm/fix-readme-conflicts
...
Remove conflicts marker in README.md
2023-02-07 11:54:13 -05:00
Cuong Manh Le
56d8c102e1
Remove conflicts marker in README.md
2023-02-07 23:22:12 +07:00
Yegor S
3602484109
Merge pull request #11 from Control-D-Inc/release-branch-v1.1.0
...
Release branch v1.1.0
2023-02-07 11:10:32 -05:00
Cuong Manh Le
0e09b45bca
cmd/ctrld: bump version to v1.1.0
2023-02-07 22:53:54 +07:00
Cuong Manh Le
8571580aae
cmd/ctrld: fatal if failed to get default iface name
...
So it left a chance for system service manager to bring up ctrld for us.
Without default iface name, ctrld could not work properly anyway.
2023-02-07 22:53:49 +07:00
Cuong Manh Le
d3fe2c730c
cmd/ctrld: surpress backoff logging message
2023-02-07 22:53:41 +07:00
Cuong Manh Le
318fec27de
cmd/ctrld: fatal loudly if listen failed
...
For address already in use error when listening, we have a workaround to
spawn a new listener on different port. However, if that case does not
match, we must fatal to notice the error to user.
2023-02-07 22:53:27 +07:00
Cuong Manh Le
beca95d5b9
cmd/ctrld: fix systemd dependencies config
...
See https://github.com/systemd/systemd/issues/22360
2023-02-07 22:53:14 +07:00
Yegor S
59619476ca
Merge pull request #13 from Control-D-Inc/goreleaser-macos-notarize
...
Add notarizing darwin binary with gon
2023-02-06 22:42:45 -05:00
Cuong Manh Le
31b30c52b1
Add notarizing darwin binary with gon
2023-02-07 09:34:42 +07:00
Cuong Manh Le
851f9b9742
all: fork tailscale Linux dns manager package
...
With modification to fit our use case.
2023-02-03 02:47:31 +07:00
Cuong Manh Le
b8772d7b4a
cmd/ctrld: log fatal if could not start the listener
2023-02-03 02:16:19 +07:00
Cuong Manh Le
eb0dd6235e
cmd/ctrld: use NetworkManager to disable DNS manager
...
Currently, ctrld force NetworkManager ignore auto DNS setup from DHCP
per connection. This does not work well, because an interface can be
attached to many connections. So if `ctrld` started with a connection,
then user connect to new one, the DNS configured by ctrld will be
override.
Instead, we can force NetworkManager not to manage DNS by:
- Using dns=none
- Set systemd-resolved=false
So NetworkManager won't attempt to send DNS setup to systemd-resolved,
leaving what ctrld set as-is.
2023-02-02 22:10:06 +07:00