18 Commits

Author SHA1 Message Date
Aaron Chen
1041d5f99b chore: use Self where applicable (#1964) 2025-06-07 16:11:17 +08:00
Integral
6b672233ec refactor: replace static with const for constants (#1805) 2024-12-09 10:26:09 +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
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
49fd1cfb40 upgrade tests, remove deps to Xcode 12 2022-12-17 10:05:06 +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
10f8e30b92 tests based on HTTP should read status line only 2021-04-28 15:59:11 +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
303f96c61f Upgrade to tokio 1.0 (#358)
* upgrade to tokio v1.0

- removed tokio::prelude
- upgrade hyper to v0.14, tokio-rustls to v0.22

still working on migrating trust-dns-* and tokio-native-tls

ref #354

* tokio v1.0 removed with_poll

fix #355, ref #354

* removed CTRL-BREAK signal handler

ref #354

* fixes compliation error, add missing return

fixes #355

* allow setting SO_SNDBUF and SO_RCVBUF for sockets

ref #352

* completely removed unix socket based DNS resolving

ref shadowsocks/shadowsocks-android#2622

* fix build issue on Windows

* fixed uds poll_write loop, fixed udp outbound loopback check

ref #355

* disable default trust-dns resolver for andorid, macos, ios

This commit also:

- Optimized resolve() logging with elapsed time
- updated tokio-native-tls

* local-dns removed from default features

* fix rustc version with rust-toolchain

* Bump bytes from 0.6.0 to 1.0.0

* add dependabot badge

* indirectly depend on trust_dns_proto via trust_dns_resolver

* auto reconnect if udp sendto failed

* recreate proxied socket if recv() returns failure

* increase score precision to 0.0001

* example of log4rs configuration

* PingBalancer instance shouldn't kill probing task when dropping

- Probing task should be controlled by the internal shared state

* switch to trust-dns main for latest tokio 1.0 support
2020-12-28 10:10:19 +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
3223ff16c9 Add DNS, HTTP, Socks4/4a tests 2020-11-15 14:23:21 +08:00