40 Commits

Author SHA1 Message Date
ty
9eefc2db3e feat: update hickory-resolver v0.25 public release
- ref hickory-dns/hickory-dns#2206

reformatted with 1.85 new formatter
2025-03-19 12:50:53 +08:00
zonyitoo
c85a74194f feat(shadowsocks): ServerConfig::new returns Result
- fix #1770
- allow users to check errors instead of just panic on wrong passwords
2024-11-17 01:18:05 +08:00
Aaron Chen
fbf968f14a chore: clippy fix (#1695) 2024-10-01 21:55:39 +08:00
zonyitoo
29fc232e1f chore: imports_granularity set to default
- imports_granularity is still unstable since 2021:
  https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=#imports_granularity
2024-08-07 00:17:00 +08:00
zonyitoo
e3855b4a8d clippy --fix 2022-12-18 11:32:46 +08:00
zonyitoo
8953210907 "acl" is available in ext-config "servers" & "locals"
The "acl" in "servers" & "locals" will have higher priority than the
global "acl" in configuration.

fix #1042
2022-12-10 17:49:43 +08:00
ty
7c154d2340 AEAD-2022 ciphers (new protocol) (#811) 2022-04-19 11:48:43 +08:00
ty
337ab16adb Local server support Tun interface for both TCP and UDP (#586)
* [POC] basic implementation of TCP redirecting tun (#581)

* [POC] basic implementation of UDP redirection of Tun

* build with action

* add configuration interface for tun

* refine document and command line options

* outbound-bind-addr instead of reusing local_address for outbound sockets

* support customizing udp expiry and capacity

* make clippy happy

* fixed build error for Android

* add docs

* make a customized AsyncFd with the released tun crate

* TUN_INTERFACE_NAME to_owned directly

* ignore accept errors for tcp tun

* tun supports Android only on master branch

* android doesnt support setting IFF_NO_PI

* set route for macos automatically when creating tun

* set route for macos directly with PF_ROUTE

* Linux-like uses ETH_P_IP and ETH_P_IPV6

* use tun on crates.io and ignores Android support temporary

* update dependencies
2021-08-22 04:49:53 +08:00
zonyitoo
0ac0f15459 allow setting mode independently for every locals and servers
ref #452

- adding `mode` in `locals` and `servers` extended format`
redir and tunnel supports customizing UDP binding address by `udp_addr`

BREAKING CHANGES:

- `sslocal` and `ssserver` command line option `-u` and `-U` can only
  control mode of command line specified local or server instance`
2021-03-14 17:09:41 +08:00
zonyitoo
6bebb6c6c0 support multiple local servers in configuration file
ref #452

- support `locals` in configuration file, running multiple local server
  instance simultaneously
- support `unix://` in `dns` configuration

BREAKING CHANGE:

- `sslocal`'s `--dns-addr` is now only available in Android
- shadowsocks-service's `Config` struct have lots of changes
2021-03-14 17:09:41 +08:00
ty
07583f3cc8 Refactored and separate library into crates (#345)
* Refactored and separate library into crates

- shadowsocks: the core feature of shadowsocks
- shadowsocks-service: library for building shadowsocks services
    - dns, http, redir, socks, tunnel
    - load balancer
- shadowsocks-rust: release binaries

fix #347

* unified DnsResolver implementation

* unified local service common parameters into ServiceContext

- ServiceContext is common parameters shared between all local
implementations
- Completely removed https local support

* add #292 reply attack protection

* migrated redir local server

* support customizing outbound socket bind address

* manager outbound socket should accepts connect_opts

* republic local implementations

* socks5 udp server should always listen to client address

* socks4 controlled by local-socks4 feature

* socks4 also obey mode configuration

* socks server tcp cannot be disable. add support of udp-bind-addr parameter

* add udp-bind-addr for customizing udp-relay bind-addr

* local-dns infra, support customizing resolver

* fully implements DNS relay server

* support binding to specific interface on Linux-like platform

* tcp cannot be disabled in socks

* enable local-flow-stat

* fixed windows build

* fixed android specific warnings and compile errors

* allow udp_only mode in socks5

* dns relay listens to both TCP and UDP, mode controls outbound upstreams

* dns relay retries twice if request failed

* doc

* fix DnsClient typo

* fix stream EncryptWriter bug

* allow disable logging output

updated dependencies

* add readme

* refine doc

* remove depending on trust-dns-client

* socks4/4a client

* allow socks5 udp_only mode, fixes compile warning

* create standalone socks5 UDP relay server

- socks5 UDP association full cone (NAT2)

* server udp relay supports full cone (NAT2)

* acl moved to crate root

* redir udp relay support full cone (NAT2)

* standard socks5 udp test must use tcp_and_udp mode

* set server context fields with pub APIs

* udp_max_associations and udp_timeout default value set in Config

* local dns resolver retry with fixed attempts

* max_udp_association keeps unlimited by default

* fixed logging binary name

* pops first exited future result for local and server

* update reverse target index cache

* fix ProxyClientStreamWriteHalf that allows sending empty buffers

ref #232

* remove unused import when socks4 is disabled

* make balancer become a globally shared object

* print plugin exit status

* control local, server, manager services in features
2020-12-20 19:06:21 +08:00
zonyitoo
6880c5892c Renamed library back to shadowsocks
- ref #326
- Binary crate will keep shadowsocks-rust's name
2020-12-01 09:09:46 +08:00
zonyitoo
4a4576bcf5 Split library and binaries into separated crates
- shadowsocks-core is a library contains all necessary functions for
running shadowsocks

- shadowsocks is a binary crate that ships end-user products

ref #326
2020-11-29 00:12:16 +08:00
zonyitoo
855fae6220 Indirect dependent to shadowsocks_crypto, reformatted 2020-11-21 13:38:02 +08:00
luozijun
c550913247 Add shadowsocks-crypto 2020-11-21 10:42:56 +08:00
zonyitoo
8c9a024967 Add Socks5 UDP client, fixed compiler warnings
- Temporary disable default feature trust-dns, local-http-rustls
2020-11-15 14:23:21 +08:00
zonyitoo
7a698e36e7 Removed unnecessary Runtime Handle in servers entry function
BREAKING: run_local, run_server, run_manager have removed Handle parameter
2020-05-10 21:55:03 +08:00
zonyitoo
05cdde3032 Refactor DNS relay
- Allow working in standalone mode
- Use same UDP socket for sending response packet
- Send TCP queries with ProxyStream directly

ref #213
2020-03-17 22:24:21 +08:00
zonyitoo
5b77751144 Uses Table cipher and aes-128-gcm for test 2020-02-24 13:31:52 +08:00
zonyitoo
20d46a1b7a [#182] Supports HTTP CONNECT relay for sslocal 2019-12-28 17:32:20 +08:00
zonyitoo
45e8bc63ed Upgrade trust-dns to alpha.3 and bump version to v1.8.0-alpha.3 2019-12-15 22:08:04 +08:00
zonyitoo
620ebafd39 Reformatted with nightly rustfmt 2019-12-07 11:32:00 +08:00
Y. T. CHUNG
a3b33f2614 Migrate to std::future, async/await (#165)
* Socks5 library, main tcp relay implementation migrated with async/await

* UDP relay local migrated to async/await

* UDP relay server migrated to async/await

* Migrated UDP DNS to async/await, follows tokio-process

* Removed unused uses, add dyn keyword for TraitObjects

* [#151] Uses dl.google.com/generate_204 to check connection latency

* Make sslocal/ssserver TCP relay work successfully, disabled UDP and DNS relay temporary

* Handshake before performing actual read & write

* Wraps timeout logic into a Connection<S> struct

* Make UDP relay work again

* Local uses copy directly

* Completely removed unused ssdns

* Fixed test

* Uses tokio::main macro for main entrance

* Fixed a missing use in local.rs

* Updated travis openssl to 1.1.0L

* Windows signal

* Migrated tokio 0.2 release with std::future support

fix #173

* fixed windows monitor build

* Uses tokio on crates.io

* ctrl_c is a Future

* Run tests with single tokio runtime

* Uses spawn_blocking only with threaded runtime

* Killing all detached Tasks if server is exited

* Updated version to v1.8.0

* Removed unused pin-project

* Uses dns resolver built in tokio

* Explicitly uses threaded scheduler by default

* Reverted, it is threaded scheduler by default

* Updated bytes to v0.5

* Updated many dependencies

* Add a tunnel app (#175)

It can be used to benchmark.

Usage:
sstunnel -v -s 127.0.0.1:8488 -m plain -k password -b 127.0.0.1:1090 -f 127.0.0.1:5201

"-f xxx" : the target/forwad address xxx

* Removed unused remote-dns config field (ssdns is removed)

* Separated TCP local tunneling to its own module

* Implements FromStr for Address

* Fixed typo

* Add tunnel unit test

* Updated tokio to v0.2.2, fixed basic scheduler bug

* Removed Connection, uses try_timeout instead. Revert back to use 8K buffer

* Revert "Removed Connection, uses try_timeout instead. Revert back to use 8K buffer"

This reverts commit 82f698e520.

* Uses Delay instead of Timeout

* Delay doesnt return io::Result

* Revert "Delay doesnt return io::Result"

This reverts commit 74dc294d16.

* Fixed bug, Connection timeout should be shared between read & write operations
2019-12-01 12:20:39 +08:00
zonyitoo
36bc0bec27 Supports camellia-*-cfb 2019-08-06 21:19:10 +08:00
zonyitoo
d048d25120 Make clippy happy 2019-04-26 01:33:20 +08:00
Linus Färnstrand
3d25b71a20 Remove extern crate statements (#143) 2019-01-26 00:30:06 +08:00
zonyitoo
cecc62e4b4 [#85] Supporting shadowsocks-manager reports 2019-01-01 14:56:29 +08:00
zonyitoo
db04bdb36d Follows config key no_delay and mode in ss-libev 2019-01-01 02:32:20 +08:00
Y. T. Chung
c60869aa50 Refactor some boxed futures with impl Trait
- Replaced EncryptedWriterFut and DecryptedReaderFut with impl Trait
- Replaced boxed future in try_timeout and io_timeout with a static type
- Modified rustfmt configuration, fully reformatted
2018-10-01 10:32:04 +08:00
Y. T. Chung
584aad21c7 Open logs in appveyor test, set timeouts for udp test 2018-05-31 00:53:53 +08:00
Y. T. Chung
8f69141b33 Call tokio::run from the outermost, allow test to run tokio runtime in multiple threads 2018-05-18 23:21:30 +08:00
Y. T. CHUNG
8be6da51f3 Migrate tokio and uses new features (#108)
* Add #102 link in README

* Migrating to tokio, #100

* Migrated to tokio-signal v0.2, reformatted

* Should not call tokio::spawn before tokio::run

* Build nightly and stable with different image tag

* Removed unnecessary rustup install

* Renamed version to v1.7.0-alpha

* Removed deprecated calls of Buf

* Updated dependencies

* [#106] Fixed bug, should not hold UDP connections forever

* Lower info log to debug

* Bump version to v1.7.0-alpha.2

* Implement a simple DNS relay server, bump version to v1.7.0-alpha.3

* Better logging

* Fixed build on travis

* Add elapsed time in log

* Should not exit if handler return error

* reformatted

* Add test for DNS

* Updated ssdns param

* Use `trust-dns` and impl Trait
1. Replaced `ToSocketAddrs` with `trust-dns`
2. Uses impl Trait for functions
3. Updated dependencies
4. Fixed bugs

* Bug fixed, logging crate in ssdns
2018-05-16 00:03:50 +08:00
Y. T. Chung
5c89e61a2e Reformatted with new rustfmt 2018-01-20 01:10:16 +08:00
quininer
32d5a2d9e9 update dependencies (#91)
update dependencies and fix #90
2018-01-08 21:44:35 +08:00
Y. T. Chung
dd848401ab Completely rewrite UDP associate 2017-08-29 23:50:10 +08:00
Y. T. Chung
eb21aba3c7 only tests with stable rust 2017-05-21 19:51:45 +08:00
BennyYip
cee4786c01 fix clippy warning 2017-05-21 18:01:06 +08:00
Y. T. Chung
8ae47907bc upgrade tokio_core, move logics to tokio_io 2017-03-20 00:55:34 +08:00
Y. T. Chung
688f693f41 remove dummy relay struct 2016-11-03 02:05:40 +08:00
Y. T. Chung
8a2b6936af correctify implement udp handler, add udp test 2016-11-01 01:10:16 +08:00