Skip to content

Commit

Permalink
fix: ServerOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
micooz committed Feb 5, 2022
1 parent bda27c8 commit 2427d06
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-manually.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ jobs:
echo "> Extract $TAR_FILE"
tar -xf $TAR_FILE -C ${{ env.DEPLOY_PATH }}
cd .bp/
echo "Stop bp process"
pm2 delete bp || true
Expand Down
2 changes: 1 addition & 1 deletion bp-cli/src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async fn handle(opts: GenerateOptions) -> Result<()> {
client_opts.server_bind = Some("__some_where__:3000".parse().unwrap());

client_opts.bind = "0.0.0.0:3000".parse().unwrap();
server_opts.key = "__some_key__".to_string();
server_opts.key = Some("__some_key__".to_string());

let content = match ext {
"yml" | "yaml" => match opts.config_type {
Expand Down
2 changes: 1 addition & 1 deletion bp-core/src/options/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Options {
pub fn key(&self) -> String {
match self {
Self::Client(opts) => opts.key.clone().unwrap(),
Self::Server(opts) => opts.key.clone(),
Self::Server(opts) => opts.key.clone().unwrap(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions bp-core/src/options/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ pub struct ServerOptions {
#[clap(short, long, default_value = DEFAULT_SERVICE_ADDRESS)]
pub bind: Address,

/// Symmetric encryption key, required
/// Symmetric encryption key
#[clap(short, long)]
pub key: String,
pub key: Option<String>,

/// Data encryption method, e.g, "plain" or "erp"
#[clap(short, long, default_value = "erp")]
Expand Down
2 changes: 1 addition & 1 deletion e2e/src/run_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub async fn run_all(

let server = run_bp(
Options::Server(ServerOptions {
key: key.clone().unwrap(),
key: key.clone(),
..server_opts_patch
}),
host,
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/udp_relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn test_udp_over_tcp() {

async fn run_test(udp_over_tcp: bool) {
let server_opts = Options::Server(ServerOptions {
key: "key".to_string(),
key: Some("key".to_string()),
..Default::default()
});

Expand Down
4 changes: 2 additions & 2 deletions usage/bp-server.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ bp-server
Run bp server

USAGE:
bp server [OPTIONS] --key <KEY>
bp server [OPTIONS]

OPTIONS:
-b, --bind <BIND> Local service bind address [default: 127.0.0.1:1080]
--config <CONFIG> Configuration file in YAML/JSON format, [default: <empty>]
--dns-server <DNS_SERVER> DNS server address [default: 8.8.8.8:53]
-e, --encryption <ENCRYPTION> Data encryption method, e.g, "plain" or "erp" [default: erp]
-h, --help Print help information
-k, --key <KEY> Symmetric encryption key, required
-k, --key <KEY> Symmetric encryption key
--quic Enable QUIC for Transport Layer, [default: false]
--tls Enable TLS for Transport Layer, [default: false]
--tls-cert <TLS_CERT> Certificate file for QUIC or TLS, [default: <empty>]
Expand Down

0 comments on commit 2427d06

Please sign in to comment.