Combine internet connections, increase your download speed

Related tags

Utilities dispatch
Overview

dispatch

A SOCKS proxy that balances traffic between network interfaces.

Should work on macOS, Windows, and Linux. Only tested on macOS for now.

This is a Rust rewrite of dispatch-proxy, originally written in CoffeeScript and targeting Node.js.

Quick links

Installation

You'll need Rust version 1.51.0 or later. You can use rustup to install the latest version of the Rust compiler toolchain.

cargo install dispatch-proxy

Rationale

You often find yourself with multiple unused internet connections—be it 5G mobile hotspot or a free Wi-Fi network—that your system won't let you use alongside your primary one.

For instance, my first student residence used to provide me with cabled and wireless internet accesses. Both were separately capped at a bandwidth 1,200kB/s. My 3G mobile internet access provided me with an additional 400kB/s. Combining all of these with dispatch and a download manager resulted in a 2,800kB/s effective bandwidth!

Use cases

The possibilities are endless:

  • Use it with a download manager or a BitTorrent client, combining multiple connections' bandwidth when downloading single files;
  • Combine as many interfaces as you have access to into a single load-balanced interface;
  • Run different apps on separate interfaces with multiple proxies (e.g. for balancing download/upload);
  • Create a hotspot proxy at home that connects through Ethernet and your 5G card for all your mobile devices;
  • etc.

Usage

$ dispatch

  dispatch 0.1.0
  A proxy that balances traffic between multiple internet connections

  USAGE:
      dispatch [FLAGS] <SUBCOMMAND>

  FLAGS:
      -d, --debug      Write debug logs to stdout instead of a file
      -h, --help       Prints help information
      -V, --version    Prints version information

  SUBCOMMANDS:
      help     Prints this message or the help of the given subcommand(s)
      list     Lists all available network interfaces
      start    Starts the SOCKS proxy server
$ dispatch start -h

  dispatch-start 0.1.0
  Starts the SOCKS proxy server

  USAGE:
      dispatch start [OPTIONS] <addresses>...

  FLAGS:
      -h, --help       Prints help information
      -V, --version    Prints version information

  OPTIONS:
          --ip <ip>        Which IP to accept connections from [default: 127.0.0.1]
          --port <port>    Which port to listen to for connections [default: 1080]

  ARGS:
      <addresses>...    The network interface IP addresses to dispatch to, in the form of <address>[@priority]

Examples

$ dispatch list

Lists all available network interfaces.

$ dispatch start 10.0.0.0 fdaa:bbcc:ddee:0:1:2:3:4

Dispatch incoming connections to local addresses 10.0.0.0 and fdaa:bbcc:ddee:0:1:2:3:4.

$ dispatch start 10.0.0.0@7 10.0.0.1@3

Dispatch incoming connections to 10.0.0.0 7 times out of 10 and to 10.0.0.1 3 times out of 10.

How It Works

Whenever the SOCKS proxy server receives an connection request to an address or domain, it selects one of the provided local addresses using the Weighted Round Robin algorithm. All further connection traffic will then go through the interface corresponding to the selected local address.

Beware: If the requested address or domain resolves to an IPv4 (resp. IPv6) address, an IPv4 (resp. IPv6) local address must be provided.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Comments
  • it wont build on windows 10

    it wont build on windows 10

    i get this error

      = note: LINK : fatal error LNK1181: cannot open input file 'Packet.lib'
    
    
    error: could not compile `dispatch-proxy` due to previous error
    
    opened by Kodi4444 5
  • can't connect

    can't connect

    Error

    Error: 
       0: An error occurred during the proxy handshake procedure
       1: The proxy received `CONNECT mail.google.com:443 HTTP/1.1` (179 additional bytes not shown), which looks like an HTTP request. Please ensure that you have properly configured the proxy as a SOCKS proxy and not an HTTP proxy.
    

    Metadata

    |key|value| |--|--| |Version|0.1.0| |OS|Windows 10 Enterprise| |Command|dispatch -d start 192.168.18.7|

    SpanTrace

    SpanTrace:
       0: dispatch::socks::handle_version_error
               with self=SocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:62620, socket: 1752 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:62620, socket: 1752 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.18.7, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) } err=InvalidVersion(67)
                 at C:\Users\Norbi\.cargo\registry\src\github.com-1ecc6299db9ec823\dispatch-proxy-0.1.0\src\socks.rs:93
       1: dispatch::server::handle_socket
               with socket=PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:62620, socket: 1752 }) } dispatcher=WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.18.7, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } })
                 at C:\Users\xxxx\.cargo\registry\src\github.com-1ecc6299db9ec823\dispatch-proxy-0.1.0\src\server.rs:19
    

    Backtrace

    Backtrace:
       0: <unknown>
       1: <unknown>
       2: <unknown>
       3: <unknown>
       4: <unknown>
       5: <unknown>
       6: <unknown>
       7: <unknown>
       8: <unknown>
       9: <unknown>
      10: <unknown>
      11: <unknown>
      12: <unknown>
      13: <unknown>
      14: <unknown>
      15: <unknown>
      16: <unknown>
      17: <unknown>
      18: <unknown>
      19: <unknown>
      20: <unknown>
      21: <unknown>
      22: <unknown>
      23: BaseThreadInitThunk
      24: RtlUserThreadStart
    
    
    opened by njunghausz 1
  • which packet.lib ?

    which packet.lib ?

    Explain please Note: you need to install Npcap and copy the appropriate Packet.lib file from the SDK (x86 or x64) to C:\Users\Username.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib in order to build on Windows.

    my errror linking with link.exe failed: exit code: 1181

    note: LINK : fatal error LNK1181: cannot open input file 'Packet.lib'

    error: could not compile dispatch-proxy due to previous error error: failed to compile dispatch-proxy v0.1.0, intermediate artifacts can be found at C:\Users\SPELLM~1\AppData\Local\Temp\cargo-installsvnr8I

    opened by vivek2545 1
  • Feature request: add interface support

    Feature request: add interface support

    Thanks so much for your powerful tool! Currently I can only start dispatch with IP address. Is there any plan to support interface name?

    For example, I want to start dispatch with dispatch start en0 en1. This is because the local IP address used in our company keeps changing every time I connect. Since I have no permission to set the static IP address, I have to check the current IP address before starting dispatch. I know I can obtain the address manually or with extra script but it would be much better (also more natural) to integrate this feature into your program.

    opened by Magnetic2014 0
  • warning: LNK4272: library machine type 'x86' conflicts with target machine type 'x64'

    warning: LNK4272: library machine type 'x86' conflicts with target machine type 'x64'

    I get this error trying to install it... any ideas?

    nd..DataLinkReceiverImpl$u20$as$u20$pnet_datalink..DataLinkReceiver$GT$4next17h3a83025691b25060E
              libpnet_datalink-0a34f7a21e78bc2e.rlib(pnet_datalink-0a34f7a21e78bc2e.pnet_datalink.89658d71-cgu.7.rcgu.o) : error LNK2019: unresolved external symbol __imp_PacketGetAdapterNames referenced in function _ZN13pnet_datalink7backend10interfaces17h6779642a4cf78618E
              C:\Users\eendi\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\Packet.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
              C:\Users\eendi\AppData\Local\Temp\cargo-installpwR1se\release\deps\dispatch-536b16db55652398.exe : fatal error LNK1120: 4 unresolved externals
    
    
    opened by Peng1029 3
  • This may be a feature or a tips: Instantly refresh Windows proxy settings

    This may be a feature or a tips: Instantly refresh Windows proxy settings

    After changing the proxy settings, whether it's enabling, disabling, or changing the address/port, it does not automatically applies to the whole system.

    This PowerShell script from stackoverflow helps it a lot. https://stackoverflow.com/a/39079005/6458107https://stackoverflow.com/questions/21568502/ie-enable-disable-proxy-settings-via-registry

    function Refresh-System
    {
      $signature = @'
    [DllImport("wininet.dll", SetLastError = true, CharSet=CharSet.Auto)]
    public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
    '@
    
    $INTERNET_OPTION_SETTINGS_CHANGED   = 39
    $INTERNET_OPTION_REFRESH            = 37
    $type = Add-Type -MemberDefinition $signature -Name wininet -Namespace pinvoke -PassThru
    $a = $type::InternetSetOption(0, $INTERNET_OPTION_SETTINGS_CHANGED, 0, 0)
    $b = $type::InternetSetOption(0, $INTERNET_OPTION_REFRESH, 0, 0)
    return $a -and $b
    }
    Refresh-System
    

    Save that script into something like RefreshPROXY.ps1 and run it whenever you need to.


    I usually turn this script into one line that you could run on command prompt, windows terminal, or inside a batch script however you want to.

    powershell -command "$signature = '[DllImport("^""wininet.dll"^"", SetLastError = true, CharSet=CharSet.Auto)] public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);'; $type = Add-Type -MemberDefinition $signature -Name wininet -Namespace pinvoke -PassThru; $type::InternetSetOption(0,39,0,0); $type::InternetSetOption(0,37,0,0);" > nul


    This could be a feature and be run as dispatch proxy-refresh if it were implemented. With it's own Rust code, of course, good luck devs... 👍

    opened by Unknown78 1
  • Any planned new features?

    Any planned new features?

    Congrats for the release with Rust as known broadly by it's safe memory handling. As a long time user, I just realized that there's a new release.

    There's a few topic from the past repo:

    1. One and only self-hosted Speedify alternative as channel bonding and not the typical ubiquitous load balancing? #82 #89
    2. Automatically restart the dispatch start after fatal crash? #93 #95 #100
    3. Automatically bypass the proxy server for local (intranet) addresses #92
    4. Why drop the support for HTTP? And even further of encrypted proxy? Such as HTTPS Proxy or the new HTTP/3 which is QUIC-based? #94

    Were part of those at least already implemented? Any milestone plan?

    opened by Unknown78 1
Owner
Alexandre Kirszenberg
Alexandre Kirszenberg
Simple async codec for rkyv. Reuses streaming buffer for maximum speed

rkyv_codec Simple async codec for rkyv. Reuses streaming buffer for maximum speed! This crate provides a makeshift adaptor for streaming &Archived<Obj

Zyansheep 19 Jun 14, 2022
Port of the fantastic Iconoir Icon Pack to Rust embedded devices, with a focus on speed, usability, and completeness.

embedded-iconoir - Icons for every device, ever. What is embedded-iconor? embedded-iconoir is a library that allows you to use Iconoir on embedded dev

null 9 Mar 25, 2023
Github mirror of codeberg repo. Monitor live bandwidth usage/ network speed on PC. Native version also available for Android, separately.

Netspeed Monitor Netspeed is a cross-platform desktop application that shows the live upload speed, download speed and day's usage as an overlay. Feat

Vishnu N K 16 May 3, 2023
Twidge is a fresh approach to productivity. It integrates with your workflow and allows you to be your most productive self.

Twidge A productivity app which is an extension to your mind Twidge is a cross platform productivity app, powered by rust, tauri, prisma-client-rust T

Twidge 187 Jun 28, 2023
Simple timer for your terminal

consoleTimer Simple timer that allows you to initiate countdown from N seconds. Usage: consoletimer [time in seconds] consoletimer [time in minutes]m

Arthur 20 Apr 4, 2022
🌲 Open the current remote repository in your browser

gitweb Some of the flags and options are subject to change in the future. Ideas are welcome. Ideas are bulletproof (V). gitweb is a command line inter

Yoann Fleury 26 Dec 17, 2022
Gather metadata about your S3 buckets

S3 Meta This tool has been migrated into s3-utils, please use that crate for future updates. A simple tool to gather data about an S3 bucket (or subse

Isaac Whitfield 48 Dec 27, 2022
A nifty commandline tool to manage your workstation.

workstation It's a nifty commandline rust tool to make you sit slightly away from your screen by blacking out the screen if you come too close and loc

Amar Lakshya (desi_tux) 16 May 6, 2022
Keep your dependencies up-to-date

Deps.rs - Dependency status at a glance Deps.rs is a service that shows you at a glance if any of your dependencies are out of date or insecure. This

deps.rs 369 Jan 5, 2023
Cross-platform bookmarks manager for your shell

shellmark: bookmark manager for shell THIS IS AN EARLY ALPHA. It works for me, but requires better UX and more polish. shellmark is a cross-platform b

Artem Pyanykh 25 Nov 10, 2022
Czkawka is a simple, fast and easy to use app to remove unnecessary files from your computer.

Multi functional app to find duplicates, empty folders, similar images etc.

Rafał Mikrut 9.2k Jan 4, 2023
🦸‍♂️ Recast migrates your old extensions to AndroidX, making them compatible with the latest version of Kodular.

Recast Recast helps make your old extensions compatible with Kodular Creator version 1.5.0 or above. Prerequisites To use Recast, you need to have Jav

Shreyash Saitwal 13 Dec 28, 2022
Add nice user-facing diagnostics to your errors without being weird about it.

thisdiagnostic is a Rust library for adding rich diagnostic metadata to errors, for some really fancy and customizable error reporting!

Kat Marchán 14 Feb 2, 2022
miette is a diagnostic library for Rust. It includes a series of traits/protocols that allow you to hook into its error reporting facilities, and even write your own error reports!

miette is a diagnostic library for Rust. It includes a series of traits/protocols that allow you to hook into its error reporting facilities, and even write your own error reports!

Kat Marchán 1.2k Jan 1, 2023
Awtomate your 🦀 microservices with awto

awto Awtomate your ?? microservices with awto What is awto? Awto treats your rust project as the source of truth for microservices, and generates data

Awto 22 Nov 4, 2022
Clean up the lines of files in your code repository

lineman Clean up the lines of files in your code repository NOTE: While lineman does have tests in place to ensure it operates in a specific way, I st

Joseph T. Lyons 4 Nov 25, 2021
A service for helping your cat find other cats

Check back later! Discord Self-hosting This is an open-source service! Feel free to host you own private instances. All we ask is you credit us and li

ibx34 4 Oct 31, 2021
Helps positioning your tauri windows.

Tauri plugin positioner A plugin for tauri that helps positioning you windows at well known locations. Install Rust [dependencies] tauri-plugin-positi

Jonas Kruckenberg 42 Jan 5, 2023
Ditch your status bar for some snazzy desktop notifications.

citron Ditch your panel for some snazzy desktop notifications. citron is: a non-intrusive alternative to status bars. on-demand, i.e. does not run in

Aziz Ben Ali 1 Jan 11, 2022