Watfaq / clash-rs

custom protocol network proxy
https://watfaq.gitbook.io/clashrs-user-manual/
Apache License 2.0
809 stars 64 forks source link

rust_lib cannot be built with `shadowsocks` anymore #583

Closed greatcat19 closed 2 months ago

greatcat19 commented 2 months ago
[dependencies]

log = "*"

# clash

clash_lib = { git = "https://github.com/Watfaq/clash-rs.git", features = [
  "shadowsocks",
] }
   Compiling tor-dirmgr v0.22.0
   Compiling arti-client v0.22.0
error[E0277]: expected a `FnOnce(&mut rustls::ClientConnection)` closure, found `std::option::Option<{closure@/Users/greatcat-user/.cargo/git/checkouts/clash-rs-84906445ae0f568a/13ceed0/clash_lib/src/proxy/shadowsocks/shadow_tls/connector.rs:49:13: 49:28}>`
   --> /Users/greatcat-user/.cargo/git/checkouts/clash-rs-84906445ae0f568a/13ceed0/clash_lib/src/proxy/shadowsocks/shadow_tls/connector.rs:52:51
    |
52  |             .connect_with(sni_name, proxy_stream, Some(session_id_generator), |_| {})
    |              ------------                         ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&mut rustls::ClientConnection)` closure, found `std::option::Option<{closure@/Users/greatcat-user/.cargo/git/checkouts/clash-rs-84906445ae0f568a/13ceed0/clash_lib/src/proxy/shadowsocks/shadow_tls/connector.rs:49:13: 49:28}>`
    |              |
    |              required by a bound introduced by this call
    |
    = help: the trait `for<'a> FnOnce(&'a mut rustls::ClientConnection)` is not implemented for `std::option::Option<{closure@/Users/greatcat-user/.cargo/git/checkouts/clash-rs-84906445ae0f568a/13ceed0/clash_lib/src/proxy/shadowsocks/shadow_tls/connector.rs:49:13: 49:28}>`
note: required by a bound in `tokio_rustls::TlsConnector::connect_with`
   --> /Users/greatcat-user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-rustls-0.26.0/src/lib.rs:125:12
    |
117 |     pub fn connect_with<IO, F>(
    |            ------------ required by a bound in this associated function
...
125 |         F: FnOnce(&mut ClientConnection),
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `TlsConnector::connect_with`

error[E0061]: this method takes 3 arguments but 4 arguments were supplied
   --> /Users/greatcat-user/.cargo/git/checkouts/clash-rs-84906445ae0f568a/13ceed0/clash_lib/src/proxy/shadowsocks/shadow_tls/connector.rs:52:14
    |
52  |             .connect_with(sni_name, proxy_stream, Some(session_id_generator), |_| {})
    |              ^^^^^^^^^^^^                                                     ------ unexpected argument #4 of type `{closure@/Users/greatcat-user/.cargo/git/checkouts/clash-rs-84906445ae0f568a/13ceed0/clash_lib/src/proxy/shadowsocks/shadow_tls/connector.rs:52:79: 52:82}`
    |
note: method defined here
   --> /Users/greatcat-user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-rustls-0.26.0/src/lib.rs:117:12
    |
117 |     pub fn connect_with<IO, F>(
    |            ^^^^^^^^^^^^
help: remove the extra argument
    |
52  -             .connect_with(sni_name, proxy_stream, Some(session_id_generator), |_| {})
52  +             .connect_with(sni_name, proxy_stream, Some(session_id_generator))
    |

Some errors have detailed explanations: E0061, E0277.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `clash_lib` (lib) due to 2 previous errors

any hints?

greatcat19 commented 2 months ago

ignore me found the reason.