Commit Graph

40 Commits

Author SHA1 Message Date
Jacob Kiers 4592c94586 Reintroduce L4P_CONFIG environment variable
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
This points to a user-configured configuration file.

Closes #5.

Signed-off-by: Jacob Kiers <code@kiers.eu>
2024-02-23 23:53:47 +01:00
Jacob Kiers 6284870059 Rename config::config to config::config_v1
To prevent module inception, which was a clippy warning.

Signed-off-by: Jacob Kiers <code@kiers.eu>
2024-02-23 23:34:19 +01:00
Jacob Kiers 97b4bf6bbe Solve synchronization issue
The async mutex in the previous variant would fail when used in a single
threaded mode, because block_in_place() cannot be used there.

Instead, replace the code with a Arc<RwLock> inside of the
UpstreamAddress to let that class take care of its own mutability.

Signed-off-by: Jacob Kiers <code@kiers.eu>
2024-02-23 23:31:23 +01:00
Jacob Kiers 59c7128f93 Remove kcp support
Signed-off-by: Jacob Kiers <code@kiers.eu>
2024-02-23 22:49:43 +01:00
Jacob Kiers 9d9f89881d Improve config file handling
continuous-integration/drone/push Build is passing Details
Signed-off-by: Jacob Kiers <code@kiers.eu>
2024-02-23 22:03:25 +01:00
Jacob Kiers ee67f7883e Rename to l4p, update references and README.md
Signed-off-by: Jacob Kiers <code@kiers.eu>
2024-02-23 22:03:25 +01:00
Jacob Kiers bb81a32349 Deduplicate some code
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-05 13:34:40 +02:00
Jacob Kiers 17b39dc6bc Prepare for new config version
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-05 13:34:40 +02:00
Jacob Kiers 07fccb6b2a Clippy
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-05 00:26:19 +02:00
Jacob Kiers 3a2367ef28 Moved upstreams to their own dedicated namespace
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-05 00:26:06 +02:00
Jacob Kiers 8404f38182 Move ProxyToUpstream parsing to TryFrom trait
This seems cleaner to me than parsing it externally.

Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-04 23:27:42 +02:00
Jacob Kiers 23296c6436 Improve code style
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-04 23:27:42 +02:00
Jacob Kiers 84f0499ec8 Remove unnecessary manual Default implementations
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-04 22:32:36 +02:00
Jacob Kiers 9564fbed6e Fix clippy warnings
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-04 22:14:51 +02:00
Jacob Kiers a574163aef Rename Upstream::Custom to Upstream::Proxy
And CustomUpstream to ProxyToUpstream.

Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-04 22:14:51 +02:00
Jacob Kiers 2651ec1f4a Fix kcp module
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-04 22:14:51 +02:00
Jacob Kiers 8dae1126d5 Deduplicate copy method
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-04 22:14:50 +02:00
Jacob Kiers da46c5873f Fix typo
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-10-04 20:48:01 +02:00
Jacob Kiers 5f0de72b88 Remove unused variable
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-08-25 22:56:46 +02:00
Jacob Kiers 40b890bc13 Add much better debug logging of address resolution
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-08-25 22:54:41 +02:00
Jacob Kiers 483c058105 Slightly better way of finding the config file
It now also looks in the current working directory.

Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-08-25 22:53:46 +02:00
Jacob Kiers 6349fc6502 Prevent unnecessary clone
This also ensures that the address resolver actually keeps state.
Otherwise it was cloned before each resolution, resulting in it never
keeping the resolved addresses.

Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-08-25 22:52:46 +02:00
Jacob Kiers cd35859c9b Initialize UpstreamAddress with actual address
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-08-25 22:51:25 +02:00
Jacob Kiers 915e39b684 Extract DNS address resolution
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-08-16 09:32:05 +02:00
Jacob Kiers 0c5153bbd6 Rename Proxy::default to ::default_action
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-08-16 09:31:20 +02:00
Jacob Kiers f4bc441ca8 Enable explicit ipv4 / ipv6 proxying
Signed-off-by: Jacob Kiers <code@kiers.eu>
2023-06-02 17:35:29 +02:00
KernelErr 8fbc0c370a Add error messages when failed to start server 2021-12-30 22:05:25 +08:00
KernelErr bff92738d5 Allow config path from FOURTH_CONFIG 2021-11-01 16:06:47 +08:00
KernelErr 754a5af794 Add publish CI and run fmt 2021-11-01 15:56:57 +08:00
KernelErr fc7a3038bd Add unknown protocol error 2021-11-01 15:32:08 +08:00
KernelErr 8a96de9666 Update README and minor refactor 2021-11-01 15:25:12 +08:00
KernelErr 0407f4b40c Add config validation 2021-11-01 13:45:47 +08:00
KernelErr 47be2568ba Add upstream scheme support
Need to implement TCP and UDP upstream support.
2021-10-31 19:21:32 +08:00
KernelErr 5944beb6a2 Combine TCP and KCP tests 2021-10-27 08:36:24 +08:00
KernelErr ee9d0685b3 Refactor TCP and KCP test 2021-10-26 23:52:07 +08:00
KernelErr a88a263d20 Move tokio_kcp to local files 2021-10-26 23:02:05 +08:00
KernelErr 55eef8581c Add KCP support 2021-10-26 21:36:12 +08:00
KernelErr 7a5ce8e1b6 Add unit tests and use Rust 2021 2021-10-25 22:12:44 +08:00
KernelErr 4352050b04 Pass Clippy and ignore shutdown error
The client might close the connection before the server noticed. So we simply ignore the error thrown by the shutdown operation.
2021-10-21 17:01:52 +08:00
KernelErr 2c2509a178 First commit 2021-10-21 16:43:59 +08:00