Correct address binding

This commit is contained in:
einisto 2022-08-12 00:44:07 +03:00
parent c45223257c
commit ea2b5fcca1
3 changed files with 6 additions and 37 deletions

View File

@ -1,33 +0,0 @@
name: Compile & Release
on:
release:
tags:
- "*"
env:
CARGO_TERM_COLOR: always
jobs:
release:
name: Release ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false # Don't fail all jobs even if one fails
matrix:
include:
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz
- target: x86_64-apple-darwin
archive: zip
steps:
- uses: actions/checkout@main
- name: Compile and release
uses: rust-build/rust-build.action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
RUSTTARGET: ${{ matrix.target }}
ARCHIVE_TYPES: ${{ matrix.archive }}
EXTRA_FILES: "README.md LICENSE"

View File

@ -1,6 +1,6 @@
## TCP socket pair for easy and efficient file transfer ## TCP socket pair for easy and efficient file transfer
Single binary containing both server and client. Originally made as an backend for [other project](https://github.com/einisto/leightbox). Single binary containing both server and client. Originally made as a backend for [a TUI app](https://github.com/einisto/leightbox). Note that the server can't be hosted on a mobile hotspot network due to firewalling of most cellular networks. Despite this the client side can still obviously be used even on those scenarios.
<p align="left"> <p align="left">
<a href="https://github.com/einisto/fragilebyte/actions/workflows/ci.yml"><img src="https://img.shields.io/github/workflow/status/einisto/fragilebyte/Cargo%20Build%20&%20Test"></a> <a href="https://github.com/einisto/fragilebyte/actions/workflows/ci.yml"><img src="https://img.shields.io/github/workflow/status/einisto/fragilebyte/Cargo%20Build%20&%20Test"></a>
@ -23,7 +23,7 @@ cargo build --release
./target/release/fragilebyte <OPTIONS> ./target/release/fragilebyte <OPTIONS>
``` ```
If no options are specified the app starts as a server by default. It can be started as a client by defining a target address with the commands shown below. If no options are specified the app starts as a server by default. It can be started as a client by defining a target address:
``` ```
USAGE: USAGE:

View File

@ -30,7 +30,10 @@ pub async fn listen(
) -> Result<(), Box<dyn Error>> { ) -> Result<(), Box<dyn Error>> {
let addr = match localhost { let addr = match localhost {
true => SocketAddr::new(IpAddr::from_str("127.0.0.1")?, port), true => SocketAddr::new(IpAddr::from_str("127.0.0.1")?, port),
false => SocketAddr::new(local_ip()?, port), false => {
println!("[+] Listening on {}:{}", local_ip()?, port);
SocketAddr::new(IpAddr::from_str("0.0.0.0")?, port)
}
}; };
// Use weak access key for integration testing, otherwise 8 char alphanumeric // Use weak access key for integration testing, otherwise 8 char alphanumeric
let access_key = match use_testing_key { let access_key = match use_testing_key {
@ -39,7 +42,6 @@ pub async fn listen(
}; };
let listener = TcpListener::bind(addr).await?; let listener = TcpListener::bind(addr).await?;
println!("[+] Listening on {}", addr);
println!("[+] Access key: {}", access_key); println!("[+] Access key: {}", access_key);
loop { loop {