cty123 / TrojanRust

Trojan-rust is a rust implementation for Trojan protocol that is targeted to circumvent GFW. This implementation focus on performance and stability above everything else.
MIT License
112 stars 24 forks source link

bug report #12

Open littlesum opened 1 year ago

littlesum commented 1 year ago

log

./trojan_rust_linux_x86_64 -c config.json thread 'main' panicked at 'Error parsing the config file: Custom { kind: InvalidData, error: Error("missing fieldmode", line: 15, column: 5) }', src/main.rs:29:48 stack backtrace: 0: rust_begin_unwind at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14 2: core::result::unwrap_failed at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5 3: std::sync::once::Once::call_once::{{closure}} 4: std::sync::once::Once::call_inner at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sync/once.rs:434:21 5: trojan_rust::main::{{closure}} 6: std::thread::local::LocalKey<T>::with 7: tokio::park::thread::CachedParkThread::block_on 8: tokio::runtime::thread_pool::ThreadPool::block_on 9: tokio::runtime::Runtime::block_on 10: trojan_rust::main note: Some details are omitted, run withRUST_BACKTRACE=fullfor a verbose backtrace.

./trojan_rust_linux_x86_64 thread 'main' panicked at 'Error parsing the config file: Custom { kind: InvalidData, error: Os { code: 2, kind: NotFound, message: "No such file or directory" } }', src/main.rs:29:48 stack backtrace: 0: rust_begin_unwind at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14 2: core::result::unwrap_failed at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5 3: std::sync::once::Once::call_once::{{closure}} 4: std::sync::once::Once::call_inner at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sync/once.rs:434:21 5: trojan_rust::main::{{closure}} 6: std::thread::local::LocalKey<T>::with 7: tokio::park::thread::CachedParkThread::block_on 8: tokio::runtime::thread_pool::ThreadPool::block_on 9: tokio::runtime::Runtime::block_on 10: trojan_rust::main note: Some details are omitted, run withRUST_BACKTRACE=fullfor a verbose backtrace.

./trojan_rust_linux_x86_64 thread 'main' panicked at 'Error parsing the config file: Custom { kind: InvalidData, error: Os { code: 2, kind: NotFound, message: "No such file or directory" } }', src/main.rs:29:48 stack backtrace: 0: 0x5637ff824cad - std::backtrace_rs::backtrace::libunwind::trace::h8e036432725b1c57 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x5637ff824cad - std::backtrace_rs::backtrace::trace_unsynchronized::h4f83092254c85869 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x5637ff824cad - std::sys_common::backtrace::_print_fmt::h9728b5e056a3ece3 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:66:5 3: 0x5637ff824cad - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h48bb4bd2928827d2 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:45:22 4: 0x5637ff846d2c - core::fmt::write::h909e69a2c24f44cc at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/fmt/mod.rs:1196:17 5: 0x5637ff81ef01 - std::io::Write::write_fmt::h7f4b8ab8af89e9ef at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/io/mod.rs:1654:15 6: 0x5637ff826485 - std::sys_common::backtrace::_print::hff4838ebf14a2171 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:48:5 7: 0x5637ff826485 - std::sys_common::backtrace::print::h2499280374189ad9 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:35:9 8: 0x5637ff826485 - std::panicking::default_hook::{{closure}}::h8b270fc55eeb284e at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:295:22 9: 0x5637ff8260f9 - std::panicking::default_hook::h3217e229d6e9d13c at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:314:9 10: 0x5637ff826a58 - std::panicking::rust_panic_with_hook::h9acb8048b738d2e0 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:698:17 11: 0x5637ff826907 - std::panicking::begin_panic_handler::{{closure}}::h70f3b839526af6dc at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:588:13 12: 0x5637ff825164 - std::sys_common::backtrace::__rust_end_short_backtrace::h1ecf2cee857fbe0a at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sys_common/backtrace.rs:138:18 13: 0x5637ff826639 - rust_begin_unwind at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:584:5 14: 0x5637ff351543 - core::panicking::panic_fmt::h9f8393e7fd56d655 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/panicking.rs:142:14 15: 0x5637ff351633 - core::result::unwrap_failed::h8b88eb424b1f8daa at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/result.rs:1785:5 16: 0x5637ff409be3 - std::sync::once::Once::call_once::{{closure}}::h3cb1026e9fb8bcc3 17: 0x5637ff3505ba - std::sync::once::Once::call_inner::h7e00b07cfc9177b0 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/sync/once.rs:434:21 18: 0x5637ff3b6af6 - trojan_rust::main::{{closure}}::h3633020e640aecfe 19: 0x5637ff42a73d - std::thread::local::LocalKey<T>::with::h1b1dd2cae74fc656 20: 0x5637ff4715da - tokio::park::thread::CachedParkThread::block_on::h6d70c2d359acf05f 21: 0x5637ff473c44 - tokio::runtime::thread_pool::ThreadPool::block_on::ha23a5f4056865696 22: 0x5637ff4cb0c3 - tokio::runtime::Runtime::block_on::he74b89146da0678b 23: 0x5637ff47ae3f - trojan_rust::main::he88ca6177664e157 24: 0x5637ff45d733 - std::sys_common::backtrace::__rust_begin_short_backtrace::h42c4215eb2aafe4b 25: 0x5637ff4b54ed - std::rt::lang_start::{{closure}}::hbdfb6706f1314abb 26: 0x5637ff819e3e - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h5f1ba3b861cac230 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/core/src/ops/function.rs:280:13 27: 0x5637ff819e3e - std::panicking::try::do_call::h4febfdb770eca39d at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:492:40 28: 0x5637ff819e3e - std::panicking::try::h8b0eac8a7d726dbf at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:456:19 29: 0x5637ff819e3e - std::panic::catch_unwind::h11b83c489c0d8394 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panic.rs:137:14 30: 0x5637ff819e3e - std::rt::lang_start_internal::{{closure}}::h63502d2988634103 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:128:48 31: 0x5637ff819e3e - std::panicking::try::do_call::h4be475cff12d2aae at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:492:40 32: 0x5637ff819e3e - std::panicking::try::h1a3b25b8eaf9ba31 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panicking.rs:456:19 33: 0x5637ff819e3e - std::panic::catch_unwind::h224588ada67b9b0b at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/panic.rs:137:14 34: 0x5637ff819e3e - std::rt::lang_start_internal::h2807b375c1959759 at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library/std/src/rt.rs:128:20 35: 0x5637ff47af22 - main 36: 0x7f550da5209b - __libc_start_main at /build/glibc-6iIyft/glibc-2.28/csu/../csu/libc-start.c:308:16 37: 0x5637ff3517ee - _start 38: 0x0 - <unknown>

cty123 commented 1 year ago

Looks like the configuration is missing the field "mode" like here: https://github.com/cty123/TrojanRust/blob/main/config/config.json#L3

littlesum commented 1 year ago

Looks like the configuration is missing the field "mode" like here: https://github.com/cty123/TrojanRust/blob/main/config/config.json#L3

Not missing "mode", i just cp config from read.md

cty123 commented 1 year ago

Does it work after you add the mode field?

littlesum commented 1 year ago

Does it work after you add the mode field?

admin@ip-172-26-15-201:~/test$ ./trojan_rust_linux_x86_64 -V
Trojan Rust 0.7.1
admin@ip-172-26-15-201:~/test$ cat config.json
{
"inbound": {
"protocol": "TROJAN",
"address": "0.0.0.0",
"secret": "123123",
"port": 8081,
"mode": "TCP",
"tls": {
"cert_path": "./cert.pem",
"key_path": "./key.pem"
}
},
"outbound": {
"protocol": "DIRECT"
}
}
admin@ip-172-26-15-201:~/test$ ./trojan_rust_linux_x86_64 -c config.json
thread 'main' panicked at 'Error parsing the config file: Custom { kind: InvalidData, error: Error("missing field `mode`", line: 15, column: 5) }', src/main.rs:29:48
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
cty123 commented 1 year ago

The outbound mode also needs a more field, the following config should work,

{
    "inbound": {
        "protocol": "TROJAN",
        "address": "0.0.0.0",
        "secret": "123123",
        "port": 8081,
        "mode": "TCP",
        "tls": {
            "cert_path": "./cert.pem",
            "key_path": "./key.pem"
        }
    },
    "outbound": {
        "protocol": "DIRECT",
        "mode": "DIRECT"
    }
}
littlesum commented 1 year ago

The outbound mode also needs a more field, the following config should work,

{
    "inbound": {
        "protocol": "TROJAN",
        "address": "0.0.0.0",
        "secret": "123123",
        "port": 8081,
        "mode": "TCP",
        "tls": {
            "cert_path": "./cert.pem",
            "key_path": "./key.pem"
        }
    },
    "outbound": {
        "protocol": "DIRECT",
        "mode": "DIRECT"
    }
}

thanks , now working!

I think readme.md should be Update