21 Commits

Author SHA1 Message Date
Integral
6b672233ec refactor: replace static with const for constants (#1805) 2024-12-09 10:26:09 +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
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
5269e59d7e Refine local DNS relay configurations
- Renamed local-dns-relay feature to local-dns
- sslocal DNS relay cmd options become --dns-addr --local-dns-addr --remote-dns-addr
- sslocal accepts --protocol dns to start standalone DNS resolver
- Hide local-tunnel specific configuration fields if feature disabled
2020-11-15 14:23:21 +08:00
zonyitoo
3223ff16c9 Add DNS, HTTP, Socks4/4a tests 2020-11-15 14:23:21 +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
zonyitoo
5b31ee89ec Updated dependencies, removed DNS packet pretty printer 2019-04-20 02:50:17 +08:00
zonyitoo
5a99c8a5c2 Updated dependencies 2019-02-14 10:19:36 +08:00
Linus Färnstrand
3d25b71a20 Remove extern crate statements (#143) 2019-01-26 00:30:06 +08:00
zonyitoo
db04bdb36d Follows config key no_delay and mode in ss-libev 2019-01-01 02:32:20 +08:00
zonyitoo
5dec63a044 Removed all global state maps, which will allow starting multiple shadowsocks instances in one process 2018-12-30 16:02:52 +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