1546088904
* Adding the beginnings of a socks5 crate * Removing unused import * Adding built.rs * Figured out test failure, stuck a note in detailing under what conditions it fails. * Added lib * wip on the way to compile * First compile with much of the client in place * Comment reflow to 80 lines * Changed Socks5 client help message * Latest changes to from develop applied to socks5 client * Minor cleanup on unused code * Adding snafu dependency * Adding socks library * Getting socks into the module structure * Tokio conversion for socks code nearly completed. * Starting traffic controllers again * Bitcoin SP starting to breathe with Socks5 proxy. Responses not yet being sent. * Adding in some hugely verbose print action so we can see things happening * WIP refactor of socks code. * Renamed structs to be more rubyish * Refactored the run command a bit. * handle_client doesn't need to be public * Starting to split the handle method up into smaller, refactorable chunks * Renamed a test * Finished initial refactor * Minor cleanup * Made a few notes for my future self * Being a bit more explicit in authtentication test * Ensuring that user/password authentication attempts fail if that auth mode is off * Documentation * Refactord types into a types module * Sending the request ID across and reading the response when it comes back. * Added the request_id to the response header * Adding exception handling to websocket send * Semi-working... * Removing non-functional examples. * Minor output clarification * Adding a Socks5 service provider * Websocket connection is now being made. * Added some simple and ungraceful websocket connection error handling * Renamed socks5_proxy back to proxy * ibid * Nicer websocket start method * Receiving messages via websocket * Socks requests work in the simple case, SSL requests don't (yet). * Minor cleanup, renaming variables and moving private functions around * Comments on try_read_request * Moved some code around * Removed commented code and printlns * Comments sp request * Commented response data read * Changing Request to Connection * ibid * Added a controller and split connection / request parsing * Built out error handling on requests a bit * Initial router action * Request deserialization tests back in action * Request constructors * Constructor for controller * Renamed message_router to controller * Starting to build out the responses * Returning proxied connection data * Moving towards new Socks5 request crate * Sending Socks5 multi-part requests through mixnet * Removed the detritus of exploratory coding. * Breaking the socks client read loop when empty bytes are read * Documenting the message format for serialized socks requests * Returning a response from the socks proxy * Removing unused import * Removing more detritus * Restarting loop if no response is received * The off-by-one change that fixed it all * Removing unused response.rs module * Removed unused import * Comment cleanup * More detritus * Cleaning... * Docs for socks5-requests * Using the simple-socks5-requests crate Response in the socks5 client * Removing unused error types * Split request/response into their own files and wrote more tests * Removing temporary README notes * Renamed all instances of request_id to connection_id * Docs on Connection struct * Caving in to connecting inside the constructor for the moment * Fixing up comments on socks5 service provider start * Simplified errors in the Socks5 requests crate * Flattened service provider module hierarchy a bit. * Removed println * Comment to explain return on timeout * Logging controller connect errors * Renamed websocket reads and writes to make them a bit more understandable * Renamed TodoError to ConnectionError * Logging errors instead of panicking on connection read/write failures * Fixed error handling in controller * Removing dead comments * Cargo fmt applied * Removing print statements * Removed more comments, prints, etc Co-authored-by: jstuczyn <jedrzej.stuczynski@gmail.com>
58 lines
2.0 KiB
Bash
Executable File
58 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#// Copyright 2020 The Nym Mixnet Authors
|
|
#//
|
|
#// Licensed under the Apache License, Version 2.0 (the "License");
|
|
#// you may not use this file except in compliance with the License.
|
|
#// You may obtain a copy of the License at
|
|
#//
|
|
#// http://www.apache.org/licenses/LICENSE-2.0
|
|
#//
|
|
#// Unless required by applicable law or agreed to in writing, software
|
|
#// distributed under the License is distributed on an "AS IS" BASIS,
|
|
#// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
#// See the License for the specific language governing permissions and
|
|
#// limitations under the License.
|
|
|
|
MAX_LAYERS=3
|
|
NUMMIXES=3
|
|
|
|
function kill_old() {
|
|
echo "Killing old testnet processes..."
|
|
killall nym-mixnode
|
|
killall nym-gateway
|
|
killall nym-client
|
|
}
|
|
|
|
if [ $# -ne 1 ]; then
|
|
echo "Expected a single argument to be passed - the directory server (that you should have independently started locally!)"
|
|
exit 1
|
|
fi
|
|
|
|
DIR=$1
|
|
|
|
echo "Press CTRL-C to stop."
|
|
|
|
kill_old
|
|
export RUST_LOG=warning
|
|
# NOTE: If we wanted to suppress stdout and stderr, replace `&` with `> /dev/null 2>&1 &` in the `run`
|
|
|
|
# cargo run --bin nym-gateway -- init --id gateway-local --mix-host 127.0.0.1:10000 --clients-host 127.0.0.1:10001 --directory $DIR
|
|
cargo run --bin nym-gateway -- run --id gateway-local &
|
|
|
|
sleep 1
|
|
|
|
# Note: to disable logging (or direct it to another output) modify the constant on top of mixnode or provider;
|
|
# Will make it later either configurable by flags or config file.
|
|
for (( j=0; j<$NUMMIXES; j++ )); do
|
|
let layer=j%MAX_LAYERS+1
|
|
cargo run --bin nym-mixnode -- init --id mix-local$j --host 127.0.0.1 --port $((9980+$j)) --layer $layer --directory $DIR
|
|
cargo run --bin nym-mixnode -- run --id mix-local$j &
|
|
sleep 1
|
|
done
|
|
|
|
|
|
# just run forever (so we'd get all network warnings in this window and you wouldn't get confused when you started another process here)
|
|
# also it seems that SIGINT is nicely passed to all processes so they kill themselves
|
|
tail -f /dev/null
|