Skip to content

Commit

Permalink
suppress dep plugin warning (#593)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibigbug authored Sep 17, 2024
1 parent 10499b6 commit d23a919
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 35 deletions.
12 changes: 2 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 14 additions & 9 deletions clash_lib/src/proxy/converters/shadowsocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,20 @@ impl TryFrom<&OutboundShadowsocks> for Handler {
cipher: s.cipher.to_owned(),
plugin_opts: match &s.plugin {
Some(plugin) => match plugin.as_str() {
"obfs" => s
.plugin_opts
.clone()
.ok_or(Error::InvalidConfig(
"plugin_opts is required for plugin obfs".to_owned(),
))?
.try_into()
.map(OBFSOption::Simple)
.ok(),
"obfs" => {
tracing::warn!(
"simple-obfs is deprecated, please use v2ray-plugin \
instead"
);
s.plugin_opts
.clone()
.ok_or(Error::InvalidConfig(
"plugin_opts is required for plugin obfs".to_owned(),
))?
.try_into()
.map(OBFSOption::Simple)
.ok()
}
"v2ray-plugin" => s
.plugin_opts
.clone()
Expand Down
26 changes: 10 additions & 16 deletions clash_lib/src/proxy/shadowsocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,17 @@ impl Handler {
) -> std::io::Result<AnyStream> {
let stream: AnyStream = match &self.opts.plugin_opts {
Some(plugin) => match plugin {
OBFSOption::Simple(opts) => {
tracing::warn!(
"simple-obfs is deprecated, please use v2ray-plugin instead"
);
match opts.mode {
SimpleOBFSMode::Http => simple_obfs::SimpleObfsHTTP::new(
s,
opts.host.clone(),
self.opts.port,
)
.into(),
SimpleOBFSMode::Tls => {
simple_obfs::SimpleObfsTLS::new(s, opts.host.clone())
.into()
}
OBFSOption::Simple(opts) => match opts.mode {
SimpleOBFSMode::Http => simple_obfs::SimpleObfsHTTP::new(
s,
opts.host.clone(),
self.opts.port,
)
.into(),
SimpleOBFSMode::Tls => {
simple_obfs::SimpleObfsTLS::new(s, opts.host.clone()).into()
}
}
},
OBFSOption::V2Ray(_opt) => {
todo!("v2ray-plugin is not implemented yet")
}
Expand Down

0 comments on commit d23a919

Please sign in to comment.