Commit Graph
47 Commits
Author SHA1 Message Date
zonyitoo 39c484f264 fixed clippy warnings 2021-05-16 01:27:14 +08:00
zonyitoo 032aba58fa make clippy happy 2021-05-07 11:55:16 +08:00
zonyitoo e8772950fb allow customizing servers' weight for balancer
- fixes #510
2021-05-07 11:35:35 +08:00
ty 4dfcc8e036 Manage UDP associations with LFU strategy (#506)
* manage UDP associations with LFU

- DNS associations could be evicted firstly then others like HTTP/3

* UDP redir caches inbound non-local socket

- Optimization: prevent creating new sockets for the same remotes

* updated libc to v0.2.94 for unified TCP options

* make clippy happy

* Pin lfu-cache to v1.2.1 for edward-shen/lfu-cache#2

* UDP target should cache with expiration 1hrs

* UDP tunnel test with an echo server

- CI crashes occasionally because of 8.8.8.8:53 doesn't respond
2021-04-28 01:27:33 +08:00
ty 8a27bb296c support TFO on Linux, FreeBSD, macOS and Windows (#487)
- ref #184
2021-04-25 23:31:13 +08:00
zonyitoo 40764b70aa update shadowsocks-crypto to v0.2.1
- updated crypto2 to 0.1.2
- support AEAD extra ciphers with aead-cipher-extra
- fixes shadowsocks/shadowsocks-android#2663
- ref shadowsocks/shadowsocks-crypto#8
2021-04-17 21:28:24 +08:00
zonyitoo ca85b6a65b make clippy happy
- allow clippy::collapsible_else_if, useful in separating feature blocks
2021-04-15 16:46:57 +08:00
zonyitoo f805b5d350 Fixed bug, concatenated buffer kept available before first write successfully 2021-04-10 09:22:53 +08:00
zonyitoo 1746c624fc release v1.10.4 2021-04-09 17:25:04 +08:00
zonyitoo 8e54d9940e fixed bug. ProxyClientStream write may missed the addr if send() returns EAGAIN 2021-04-09 17:20:00 +08:00
zonyitoo 81cd368172 replaced lazy_static with once_cell 2021-04-02 10:19:20 +08:00
DuckSoft b0de896c16 don't panic when sip002 account is invalid 2021-04-01 17:05:19 +08:00
zonyitoo c6d70f3786 PingBalancer fixed 2nd check after sleep
- Updated shadowsocks-crypto to v0.2.0
- Updated other dependencies with minor changes
2021-03-23 14:21:42 +08:00
zonyitoo 587e566fa3 convert libc sockaddr to SocketAddr explicitly
SocketAddr may not have the same layout as libc, rust-lang/rust#78802

- fixes #462
- ref tokio-rs/mio#1388, rust-lang/socket2#120
2021-03-22 09:35:45 +08:00
dependabot-preview[bot] bf409c20a1 Bump spin from 0.8.0 to 0.9.0
Bumps [spin](https://github.com/mvdnes/spin-rs) from 0.8.0 to 0.9.0.
- [Release notes](https://github.com/mvdnes/spin-rs/releases)
- [Changelog](https://github.com/mvdnes/spin-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mvdnes/spin-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-19 17:45:33 +08:00
zonyitoo 4e8e4fe75e updated dependencies, spin v0.8, trust-dns supports quad9_https predefined DNS 2021-03-16 18:25:23 +08:00
zonyitoo fd926bb8d7 update socket2 to v0.4
- Domain uses IPV4 and IPV6
- Type uses DGRAM
- Protocol uses UDP and TCP
- into_udp_socket uses Into::into

fixes #456
2021-03-15 16:15:06 +08:00
zonyitoo 435de948b9 updated dependencies, tokio v1.3 2021-03-14 17:09:41 +08:00
zonyitoo dbe51e466d check server config is_basic 2021-03-14 17:09:41 +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
zonyitoo 4a08d400f3 release v1.9.2 2021-03-06 01:19:53 +08:00
zonyitoo a021cc4c1e check repeated salt after first successful decryption
fixes #442
2021-03-05 16:44:33 +08:00
zonyitoo 510b4886b6 mips removes opt-level=z
binary size have no significant differences
2021-02-27 03:27:31 +08:00
zonyitoo f1f895e511 release v1.9.1 2021-02-26 19:06:02 +08:00
zonyitoo 93506f00af Fixed bug, UdpSocket::from_std requires socket to be non-blocked 2021-02-26 18:34:35 +08:00
dependabot-preview[bot] ec927e6f1f Bump nix from 0.19.1 to 0.20.0
Bumps [nix](https://github.com/nix-rust/nix) from 0.19.1 to 0.20.0.
- [Release notes](https://github.com/nix-rust/nix/releases)
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-22 16:09:27 +08:00
zonyitoo b3de247652 ready for publishing v1.9.0 2021-02-22 09:31:24 +08:00
zonyitoo 61b36e71d0 set dual stack mode for IPv6 unspecified addr listener 2021-02-19 10:41:21 +08:00
zonyitoo 63be38deca updated tokio 2021-02-07 09:33:17 +08:00
zonyitoo 1bb86e47b0 set IP_BOUND_IF for darwin (macos) 2021-02-06 00:03:08 +08:00
zonyitoo 69fea0a9c9 enables "std" feature of "spin" for yielding threads when spinning
fixes #408
2021-02-04 09:09:03 +08:00
zonyitoo a34ae200b3 fixed warning on Android
ref shadowsocks/shadowsocks-android#2667
2021-02-02 10:25:17 +08:00
dependabot-preview[bot] 6a65aae5b8 Bump notify from 5.0.0-pre.4 to 5.0.0-pre.5
Bumps [notify](https://github.com/notify-rs/notify) from 5.0.0-pre.4 to 5.0.0-pre.5.
- [Release notes](https://github.com/notify-rs/notify/releases)
- [Changelog](https://github.com/notify-rs/notify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/notify-rs/notify/compare/v5.0.0-pre.4...v5.0.0-pre.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-02-02 09:40:11 +08:00
zonyitoo be6049f35b set timeout for VpnService.protect() for UDP sockets
ref shadowsocks/shadowsocks-android#2667
2021-02-01 09:19:01 +08:00
zonyitoo b723abd616 use server's timeout setting as connect() timeout 2021-01-29 13:21:27 +08:00
zonyitoo 621d4740e2 set timeout for protect() of Android's VpnService
ref shadowsocks/shadowsocks-android#2667
2021-01-29 12:44:14 +08:00
dependabot-preview[bot] 97bd5ae24c Bump tokio from 1.0.2 to 1.1.0
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.0.2 to 1.1.0.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.0.2...tokio-1.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-01-25 16:41:26 +08:00
zonyitoo 3094ec62bb Linux auto-reload /etc/resolv.conf when using trust-dns
- temporary bypassed bluejekyll/trust-dns#1132
2021-01-19 16:21:51 +08:00
zonyitoo 9000b31ffb Disable deprecated stream ciphers by default
- Enable stream ciphers explicitly with stream-cipher feature
- Upgraded shadowsocks-crypto to v0.1.2

fixes #373
2021-01-04 23:09:12 +08:00
zonyitoo 9abf3847c1 check UDP packet's data length before decrypt_packet
fixes shadowsocks/crypto2#8
2020-12-31 19:58:22 +08:00
zonyitoo 474e57a331 unified local UDP association implementation
NOTE: Every time when sending packets back to local listener will
require an allocation of Box<Pin<Future>> because GAT is not stablized
yet.
2020-12-31 13:07:34 +08:00
zonyitoo 2bcc40c4f7 upgrade to trust-dns-resolver v0.20 release 2020-12-30 09:16:20 +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
zonyitoo 9210ee63ac local server starts after plugins are started, and balancer have choosen the best server 2020-12-22 15:11:49 +08:00
zonyitoo 3d8c4cb641 lower log level to trace 2020-12-22 09:17:20 +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