Git Product home page Git Product logo

dispatch's People

Contributors

alexkirsz avatar gregyjames avatar striezel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dispatch's Issues

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.

Unable to install dispatch-proxy (access denied when installing rayon-core)

Hello, I am trying to install dispatch with cargo install dispatch-proxy, but this kept on happening

For context I tried this with both cmd and powershell, both is running as administrator. But none seems to work. (This is on Windows 11)

Any idea on why is this happening?

error: failed to run custom build command for `rayon-core v1.10.2`

Caused by:
  could not execute process `C:\Users\REBELL~1\AppData\Local\Temp\cargo-installoKyhd0\release\build\rayon-core-0e87e82985a34333\build-script-build` (never executed)

Caused by:
  Access is denied. (os error 5)

Complete log:

    Updating crates.io index
  Installing dispatch-proxy v0.1.0
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.51
   Compiling winapi v0.3.9
   Compiling quote v1.0.23
   Compiling unicode-ident v1.0.6
   Compiling syn v1.0.107
   Compiling cfg-if v1.0.0
   Compiling memchr v2.5.0
   Compiling once_cell v1.17.0
   Compiling libc v0.2.139
   Compiling log v0.4.17
   Compiling serde v1.0.152
   Compiling pin-project-lite v0.2.9
   Compiling regex-syntax v0.6.28
   Compiling lazy_static v1.4.0
   Compiling tracing-core v0.1.30
   Compiling crossbeam-utils v0.8.14
   Compiling num-traits v0.2.15
   Compiling num-integer v0.1.45
   Compiling version_check v0.9.4
   Compiling memoffset v0.7.1
   Compiling aho-corasick v0.7.20
   Compiling serde_json v1.0.92
   Compiling windows_x86_64_msvc v0.42.1
   Compiling regex-automata v0.1.10
   Compiling crossbeam-epoch v0.9.13
   Compiling itoa v1.0.5
   Compiling regex v1.7.1
   Compiling ryu v1.0.12
   Compiling num_cpus v1.15.0
   Compiling matchers v0.0.1
   Compiling proc-macro-error-attr v1.0.4
   Compiling tracing-log v0.1.3
   Compiling sharded-slab v0.1.4
   Compiling thread_local v1.1.4
   Compiling scopeguard v1.1.0
   Compiling tinyvec_macros v0.1.1
   Compiling smallvec v1.10.0
   Compiling tinyvec v1.6.0
   Compiling windows-sys v0.42.0
   Compiling proc-macro-error v1.0.4
   Compiling tracing-serde v0.1.3
   Compiling crossbeam-channel v0.5.6
   Compiling tokio v1.25.0
   Compiling unicode-width v0.1.10
   Compiling rayon-core v1.10.2
   Compiling cc v1.0.79
   Compiling unicode-normalization v0.1.22
   Compiling time v0.1.45
   Compiling iana-time-zone v0.1.53
   Compiling ansi_term v0.12.1
   Compiling chrono v0.4.23
   Compiling mio v0.8.5
error: failed to run custom build command for `rayon-core v1.10.2`

Caused by:
  could not execute process `C:\Users\REBELL~1\AppData\Local\Temp\cargo-installoKyhd0\release\build\rayon-core-0e87e82985a34333\build-script-build` (never executed)

Caused by:
  Access is denied. (os error 5)
warning: build failed, waiting for other jobs to finish...
error: failed to compile `dispatch-proxy v0.1.0`, intermediate artifacts can be found at `C:\Users\REBELL~1\AppData\Local\Temp\cargo-installoKyhd0`

<autogenerated-issue>

Error

Error: 
   0: An error occurred during the proxy handshake procedure
   1: invalid SOCKS version 01, expected 04

Metadata

key value
Version 0.1.3
OS Windows 11 Education
Command C:\Users\pznet\Downloads\dispatch-proxy-x86_64-pc-windows-msvc\dispatch-proxy-x86_64-pc-windows-msvc\dispatch.exe -d start 10.194.66.212 192.168.2.245 --port 6060

SpanTrace

SpanTrace:
   0: dispatch::socks::handle_request_v4
           with �[3mself�[0m�[2m=�[0mSocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:6060, peer: 127.0.0.1:5845, socket: 924 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:6060, peer: 127.0.0.1:5845, socket: 924 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 10.194.66.212, weight: 1 }, WeightedAddress { ip: 192.168.2.245, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) }
             at src\socks.rs:259
   1: dispatch::socks::handle_handshake_with_version
           with �[3mself�[0m�[2m=�[0mSocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:6060, peer: 127.0.0.1:5845, socket: 924 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:6060, peer: 127.0.0.1:5845, socket: 924 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 10.194.66.212, weight: 1 }, WeightedAddress { ip: 192.168.2.245, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) } �[3mversion�[0m�[2m=�[0mV4
             at src\socks.rs:121
   2: dispatch::server::handle_socket
           with �[3msocket�[0m�[2m=�[0mPollEvented { io: Some(TcpStream { addr: 127.0.0.1:6060, peer: 127.0.0.1:5845, socket: 924 }) } �[3mdispatcher�[0m�[2m=�[0mWeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 10.194.66.212, weight: 1 }, WeightedAddress { ip: 192.168.2.245, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } })
             at 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: BaseThreadInitThunk
  22: RtlUserThreadStart

I don't understand how to use it

As an amateur dev with still a lot to learn, I struggle understanding how to use this program.

My OS is KDE Neon, based on Ubuntu 22.04. I have an ethernet connection [ADSL] and a wifi connection [4G hotspot]. Both work when used independently, with a low bandwith (128 Kb/s) in my rural area - hence my looking for a bonding solution.

When I do "dispatch list", I get :

[wifi interface] 192.168.0.100
[ethernet interface] 192.168.1.5

Therefore, I start the proxy using:
dispatch start 192.168.0.100 192.168.1.5

Then I went to the OS settings, and activated manually a proxy, by entering "localhost" in the SOCKS section, port 1080. I also manually configured my browser to use that proxy, since I read that Firefox and many other browsers don't use the system proxy for some reason.

Then I configured a widget to monitor the bandwith on both interfaces and started using different software (browser, torrent, radio app). It still "works" but only the ethernet connection is used.

Should my configuration work?

can't connect while using the proxy server

i tried to configure in internet options the proxy as socks proxy and leave others empty but it didn't resolve it

Error

Error: 
   0: An error occurred during the proxy handshake procedure
   1: invalid SOCKS version 01, expected 04

Metadata

key value
Version 0.1.0
OS Windows 10 Home
Command dispatch --debug start 192.168.42.242

SpanTrace

SpanTrace:
   0: dispatch::socks::handle_request_v4
           with self=SocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:63083, socket: 1268 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:63083, socket: 1268 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.42.242, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) }
             at C:\Users\Madjid\.cargo\registry\src\github.com-1ecc6299db9ec823\dispatch-proxy-0.1.0\src\socks.rs:259
   1: dispatch::socks::handle_handshake_with_version
           with self=SocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:63083, socket: 1268 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:63083, socket: 1268 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.42.242, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) } version=V4
             at C:\Users\Madjid\.cargo\registry\src\github.com-1ecc6299db9ec823\dispatch-proxy-0.1.0\src\socks.rs:121
   2: dispatch::server::handle_socket
           with socket=PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:63083, socket: 1268 }) } dispatcher=WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.42.242, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } })
             at C:\Users\Madjid\.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: BaseThreadInitThunk
  22: RtlUserThreadStart

ntapi dependency problem

Hello,
Installing on windows (x86_64) throws this error
error[E0793]: reference to packed field is unaligned --> C:\Users\zoltan.berzsenyi\.cargo\registry\src\github.com-1ecc6299db9ec823\ntapi-0.3.7\src\ntexapi.rs:2783:52 | 2783 | *tick_count.QuadPart_mut() = read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and useread_unaligned/write_unaligned(loads and stores via*p` must be properly aligned even when using raw pointers)

error[E0793]: reference to packed field is unaligned
--> C:\Users\zoltan.berzsenyi.cargo\registry\src\github.com-1ecc6299db9ec823\ntapi-0.3.7\src\ntexapi.rs:2807:25
|
2807 | ((read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use read_unaligned/write_unaligned (loads and stores via *p must be properly aligned even when using raw pointers)

Compiling pnet_datalink v0.28.0
For more information about this error, try rustc --explain E0793.
error: could not compile ntapi due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile dispatch-proxy v0.1.0, intermediate artifacts can be found at C:\Users\ZOLTAN~1.BER\AppData\Local\Temp\cargo-install3vuh4q
`

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

Please give ready made Windows Build 32bit and 64bit

You guys are doing wonderful job.
But not giving easy solutions to test.
No Windows build given.
Cargo and rustup are not popular every where.

No (Detailed Windows build instructions) on the below link,
5400f83

I have installed and copied Packet.lib
What next and how to build Windows exe ?

EDIT:
After several hours of try I had successfully built the dispatch.exe
"dispatch list" command shows all the VMWare virtual adopters
But the main Ethernet and Cell phone tethered adopters not showing.

Where as old Node.js dispatch-Proxy works great.
Seems some issue in this code.

Published to homebrew

It is recommended to publish to homebrew, which is easier to control through the brew service.

Packet.lib file isn't installed by npcap-1.73.exe

Hello,

I'm trying to use this tool but when installing Npcap 1.73 file Packet.lib doesn't exist, choosing installation option "Install Npcap in WinPcap API-compatible Mode, the only file I can find that is close is Packet.dll.

Can you provide assistance, sorry if I am making an obvious mistake I don't have much experience with this sort of thing?

<autogenerated-issue>

Error

Error: 
   0: An error occurred during the proxy handshake procedure
   1: invalid SOCKS version 01, expected 04

Metadata

key value
Version 0.1.3
OS Windows 10 Pro
Command C:\Users\user.cargo\bin\dispatch.exe --debug start 10.2.13.35 10.10.134.70

SpanTrace

SpanTrace:
   0: dispatch::socks::handle_request_v4
           with �[3mself�[0m�[2m=�[0mSocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:54649, socket: 2128 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:54649, socket: 2128 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 10.2.13.35, weight: 1 }, WeightedAddress { ip: 10.10.134.70, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) }
             at src\socks.rs:259
   1: dispatch::socks::handle_handshake_with_version
           with �[3mself�[0m�[2m=�[0mSocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:54649, socket: 2128 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:54649, socket: 2128 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 10.2.13.35, weight: 1 }, WeightedAddress { ip: 10.10.134.70, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) } �[3mversion�[0m�[2m=�[0mV4
             at src\socks.rs:121
   2: dispatch::server::handle_socket
           with �[3msocket�[0m�[2m=�[0mPollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:54649, socket: 2128 }) } �[3mdispatcher�[0m�[2m=�[0mWeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 10.2.13.35, weight: 1 }, WeightedAddress { ip: 10.10.134.70, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } })
             at 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: BaseThreadInitThunk
  22: RtlUserThreadStart

[improvement] don't dispatch to not connected interface

(just discovered your utility, very nice and useful, thanks)

if i use

dipatch start ip ipnotconnected

it works, really good because i don't have to change the start command when i have an interface not connected...

but... dispatch still tries to send requests to the ipnotconnected interface

could be useful to check on startup the ips so no more errors while using internet

thanks

Question: No sign of life

image

as shown in the image, the proxy has been set up. There is no traffic and all web pages say no data sent. No effect in torrenting software either.

What might be wrong? Much thanks!

When an ethernet connection is active, the wifi connection stops working

With Ethernet+WiFi (wlp1s0 addresses in use for proxy):

curl -x socks5://127.0.0.1:1080 http://api.ipify.org
(hangs)

With WiFi only (wlp1s0 addresses in use for proxy):

curl -x socks5://127.0.0.1:1080 http://api.ipify.org
85.XX.XX.XX

With Ethernet+Wifi (eno1 addresses in use for proxy):

curl -x socks5://127.0.0.1:1080 http://api.ipify.org
84.XXX.XXX.XXX

Using socks4 with any configuration results in curl: (97) Recv failure: Connection reset by peer.
Running on Arch Linux, have ethernet and wifi. Is this a kernel limitation or something wrong with rust's networking/this program?

Is there any plan to support dynamic ip PPPOE?

I'm having 3 pppoe and getting trouble in loading balance them. Then i found this project but it must provide correct IP, which is very hard for me to do because IP changes each reboot. So is there any plan to support them?

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

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?

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... 👍

<autogenerated-issue>

Error

Error: 
   0: An error occurred during the proxy handshake procedure
   1: The proxy received `CONNECT filr.mesk.de:443 HTTP/1.1` (28 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.3
OS Windows 10 Home
Command dispatch --debug start 192.168.178.177

SpanTrace

SpanTrace:
   0: dispatch::socks::handle_version_error
           with �[3mself�[0m�[2m=�[0mSocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:62101, socket: 1468 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:62101, socket: 1468 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.178.177, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) } �[3merr�[0m�[2m=�[0mInvalidVersion(67)
             at C:\Users\gabri\.cargo\registry\src\index.crates.io-6f17d22bba15001f\dispatch-proxy-0.1.3\src\socks.rs:93
   1: dispatch::server::handle_socket
           with �[3msocket�[0m�[2m=�[0mPollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:62101, socket: 1468 }) } �[3mdispatcher�[0m�[2m=�[0mWeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.178.177, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } })
             at C:\Users\gabri\.cargo\registry\src\index.crates.io-6f17d22bba15001f\dispatch-proxy-0.1.3\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: BaseThreadInitThunk
  22: RtlUserThreadStart

Feature request: TUN mode

Create a TUN interface which serves as the default gateway, allowing for the proxying of all traffic without the need for additional proxy settings.

<autogenerated-issue>

Error

Error: 
   0: An error occurred during the proxy handshake procedure
   1: The proxy received `CONNECT af.opera.com:443 HTTP/1.1` (197 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.3
OS Windows 10 Home
Command dispatch --debug start 192.168.178.177

SpanTrace

SpanTrace:
   0: dispatch::socks::handle_version_error
           with �[3mself�[0m�[2m=�[0mSocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:62375, socket: 1056 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:62375, socket: 1056 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.178.177, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) } �[3merr�[0m�[2m=�[0mInvalidVersion(67)
             at C:\Users\gabri\.cargo\registry\src\index.crates.io-6f17d22bba15001f\dispatch-proxy-0.1.3\src\socks.rs:93
   1: dispatch::server::handle_socket
           with �[3msocket�[0m�[2m=�[0mPollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:62375, socket: 1056 }) } �[3mdispatcher�[0m�[2m=�[0mWeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.178.177, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } })
             at C:\Users\gabri\.cargo\registry\src\index.crates.io-6f17d22bba15001f\dispatch-proxy-0.1.3\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: BaseThreadInitThunk
  22: RtlUserThreadStart

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

Dns dispatch

I have two lan interface: 192.168.1.1 and 192.168.1.2
when I use
dispatch.exe --debug start 192.168.1.2 --ip 127.0.0.1 --port 1080
it download from 192.168.1.2
but resolve dns from 192.168.1.1
do it is possible to set to resolve also dns from 192.168.1.2 ?
Or it is a browser problem when use PAC?

Socksv4 not supported?

Info

So apparently trying this on windows proxy it didn't want to work
However manually putting it on firefox works.
When i set socks to v4 on firefox it completely refuses to connect whilst putting it on v5 works fine

Error

Error: 
   0: An error occurred during the proxy handshake procedure
   1: invalid SOCKS version 01, expected 04

Metadata

key value
Version 0.1.3
OS Windows 10 Pro
Command dispatch2 --debug start 192.168.1.243 10.80.69.107

SpanTrace

SpanTrace:
   0: dispatch::socks::handle_request_v4
           with �[3mself�[0m�[2m=�[0mSocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:49965, socket: 1816 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:49965, socket: 1816 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.1.243, weight: 1 }, WeightedAddress { ip: 10.80.69.107, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) }
             at src\socks.rs:259
   1: dispatch::socks::handle_handshake_with_version
           with �[3mself�[0m�[2m=�[0mSocksHandshake { reader: ReadHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:49965, socket: 1816 }) }), writer: WriteHalf(PollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:49965, socket: 1816 }) }), dispatcher: WeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.1.243, weight: 1 }, WeightedAddress { ip: 10.80.69.107, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } }) } �[3mversion�[0m�[2m=�[0mV4
             at src\socks.rs:121
   2: dispatch::server::handle_socket
           with �[3msocket�[0m�[2m=�[0mPollEvented { io: Some(TcpStream { addr: 127.0.0.1:1080, peer: 127.0.0.1:49965, socket: 1816 }) } �[3mdispatcher�[0m�[2m=�[0mWeightedRoundRobinDispatcher(Mutex { data: WeightedRoundRobinDispatcherInner { ipv4: State { addresses: [WeightedAddress { ip: 192.168.1.243, weight: 1 }, WeightedAddress { ip: 10.80.69.107, weight: 1 }], address_idx: 0, count: 0 }, ipv6: State { addresses: [], address_idx: 0, count: 0 } } })
             at 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: BaseThreadInitThunk
  22: RtlUserThreadStart

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.