-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove hardcoded configuration within the SS example (#21)
* update: remove hardcoded config parts in SS * update: add compilation+opt script for WATM, remove clone
- Loading branch information
1 parent
931e049
commit c32920b
Showing
13 changed files
with
148 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//! Specific config for the ss client, with more fields like password, | ||
//! and others like cipher method(adding later) | ||
use serde::Deserialize; | ||
|
||
// A Config currently contains the local + remote ip & port | ||
#[derive(Debug, Deserialize, Clone)] | ||
pub struct SSConfig { | ||
pub remote_address: String, | ||
pub remote_port: u32, | ||
pub local_address: String, | ||
pub local_port: u32, | ||
pub password: String, | ||
pub bypass: bool, | ||
// NOTE: will add the config for cipher method later | ||
// pub method: CipherKind, | ||
} | ||
|
||
impl Default for SSConfig { | ||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} | ||
|
||
// implement a constructor for the config | ||
impl SSConfig { | ||
pub fn new() -> Self { | ||
SSConfig { | ||
remote_address: String::from("example.com"), | ||
remote_port: 8082, | ||
local_address: String::from("127.0.0.1"), | ||
local_port: 8080, | ||
password: String::from("Test!23"), | ||
bypass: false, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# Check if the required command line arguments are provided | ||
if [ $# -ne 2 ]; then | ||
echo "Usage: $0 <examples/water_bins/<???>> <wasm_name>" | ||
exit 1 | ||
fi | ||
|
||
# Change directory to the source directory | ||
cd "examples/water_bins/$1" || exit 1 | ||
|
||
# Build the project using cargo | ||
cargo build --target wasm32-wasi || exit 1 | ||
|
||
# Optimize the generated wasm file | ||
wasm-opt --strip-debug "../../../target/wasm32-wasi/debug/$2.wasm" -o "./$2.wasm" || exit 1 | ||
|
||
# Copy the optimized wasm file to the destination directory | ||
cp "./$2.wasm" "../../../tests/test_wasm/" || exit 1 | ||
|
||
# Change directory back to the beginning directory | ||
cd - || exit 1 | ||
|
||
echo "Wasm file $2.wasm successfully built, optimized, and copied to ./tests/test_wasm/" |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters