Git Product home page Git Product logo

wghttp's Introduction

wghttp

Turn WireGuard to HTTP & SOCKS5 proxies.

The HTTP & SOCKS5 proxies are served on same port. It runs in userspace, without requirement of WireGuard kernel module or TUN device.

In remote exit mode, the proxy is served on local network, and the traffic from proxy server goes to WireGuard network.

In local exit mode, the proxy is served on WireGuard network, and the traffic from WireGuard goes to local network.

For detailed usage, see https://github.com/zhsj/wghttp/tree/master/docs.

wghttp's People

Contributors

zhsj 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

wghttp's Issues

only http works?

root@FriendlyWrt:/etc/warp#  curl g.co --proxy socks5://127.0.0.1:31080
curl: (97) connection to proxy closed
root@FriendlyWrt:/etc/warp#  curl g.co --proxy http://127.0.0.1:31080
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://g.co/">here</A>.
</BODY></HTML>

Support ListenPort

This program lacks support for ListenPort option of WireGuard, which, in case of client, binds outgoing UDP socket to the supplied source port.
This is necessary to bypass NAT. Would appreciate this option.

Unable to compile

Hello,

I tried today to compile using go 1.20

# go install github.com/zhsj/[email protected]
go: downloading github.com/zhsj/wghttp v0.3.1
go: downloading golang.zx2c4.com/wireguard v0.0.0-20220829161405-d1d08426b27b
go: downloading golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86
go: downloading gvisor.dev/gvisor v0.0.0-20220817001344-846276b3dbc5
package github.com/zhsj/wghttp
	imports golang.zx2c4.com/wireguard/tun/netstack
	imports gvisor.dev/gvisor/pkg/bufferv2
	imports gvisor.dev/gvisor/pkg/atomicbitops
	imports gvisor.dev/gvisor/pkg/cpuid
	imports gvisor.dev/gvisor/pkg/state
	imports gvisor.dev/gvisor/pkg/state/wire
	imports gvisor.dev/gvisor/pkg/gohacks: build constraints exclude all Go files in /root/go/pkg/mod/gvisor.dev/[email protected]/pkg/gohacks

seems similar to this issue abiosoft/colima#401

Can you fix that ?
Thank you !

Proxy in torrent client

Hello. I want to use wghttp as a proxy for qBitTorrent. But when I set an address that wghttp is listening on, I don't get connections to peers. wghttp itself throws errors. I tried http and socks5 protocol in torrent client but the behavior is the same.

  • wghttp in docker
  • windows system
  • qBitTorrent latest version (on qt6, also tried beta)
  • Everything is ok with the connection data itself (I checked it in the Wireguard application)

I will run more tests. I'll tell you exactly what errors I'm getting while I'm asking: can a more detailed log be activated to exclude wghttp?

It is low efficiency to use wghttp to convert WireGuard to HTTP or Socket

My computer: Windows 10.0.19044
Official: Windows desktop client (App: 0.5.3 Driver: 0.10.1)
WGHTTP: latest source build, Go version: 19.1
Test: telecom 200 m broadband in China > WarpPlus (Cloudflare) > managed to Cloudflare CDN (test file: https://cdn.57777777.xyz/1080p.mp4)
Download using the IDM (16 thread)
Only 500k-1.5m speed with WGHTTP and 8-15m /s speed with official client
Maybe the official use of Tun equipment is more efficient. But this difference is quite big. I hope you can think this part

can't build

I build it with such steps:

root@FriendlyWrt:~# go install github.com/zhsj/wghttp@latest
go: downloading github.com/zhsj/wghttp v0.3.2
go: downloading github.com/jessevdk/go-flags v1.5.0
go: downloading golang.zx2c4.com/wireguard v0.0.0-20230209153558-1e2c3e5a3c14
go: downloading golang.org/x/sys v0.2.0
go: downloading golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd
go: downloading gvisor.dev/gvisor v0.0.0-20221203005347-703fd9b7fbc0
go: downloading golang.org/x/net v0.0.0-20220225172249-27dd8689420f
go: downloading github.com/google/btree v1.0.1
go: downloading golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
package github.com/zhsj/wghttp
        imports golang.zx2c4.com/wireguard/tun/netstack
        imports gvisor.dev/gvisor/pkg/bufferv2
        imports gvisor.dev/gvisor/pkg/atomicbitops
        imports gvisor.dev/gvisor/pkg/cpuid
        imports gvisor.dev/gvisor/pkg/state
        imports gvisor.dev/gvisor/pkg/state/wire
        imports gvisor.dev/gvisor/pkg/gohacks: build constraints exclude all Go files in /root/go/pkg/mod/gvisor.dev/[email protected]/pkg/gohacks





# Update
root@FriendlyWrt:~/go/pkg/mod/github.com/zhsj/[email protected]# go get -u
go: downloading golang.org/x/sys v0.15.0
go: downloading golang.zx2c4.com/wireguard/tun/netstack v0.0.0-20220703234212-c31a7b1ab478
go: downloading golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173
go: downloading golang.org/x/net v0.19.0
go: downloading golang.org/x/crypto v0.17.0
go: downloading golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224
go: downloading gvisor.dev/gvisor v0.0.0-20231228213732-de71aae89aed
go: downloading golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2
go: downloading github.com/google/btree v1.1.2
go: downloading golang.org/x/time v0.5.0
go: upgraded go 1.18 => 1.21.1
go: added toolchain go1.21.5
go: upgraded github.com/google/btree v1.0.1 => v1.1.2
go: upgraded golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd => v0.17.0
go: upgraded golang.org/x/net v0.0.0-20220225172249-27dd8689420f => v0.19.0
go: upgraded golang.org/x/sys v0.2.0 => v0.15.0
go: upgraded golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba => v0.5.0
go: upgraded golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224 => v0.0.0-20230126152724-0fa3db229ce2
go: upgraded golang.zx2c4.com/wireguard v0.0.0-20230209153558-1e2c3e5a3c14 => v0.0.0-20231211153847-12269c276173
go: upgraded gvisor.dev/gvisor v0.0.0-20221203005347-703fd9b7fbc0 => v0.0.0-20231228213732-de71aae89aed





# build again
root@FriendlyWrt:~/go/pkg/mod/github.com/zhsj/[email protected]# go build
# gvisor.dev/gvisor/pkg/bits
../../../gvisor.dev/[email protected]/pkg/bits/uint64_arch.go:35:9: undefined: MaskOf64
# gvisor.dev/gvisor/pkg/waiter
../../../gvisor.dev/[email protected]/pkg/waiter/waiter.go:140:2: undefined: waiterEntry
../../../gvisor.dev/[email protected]/pkg/waiter/waiter.go:211:7: undefined: waiterList
root@FriendlyWrt:~/go/pkg/mod/github.com/zhsj/[email protected]# 

Not working

Hello. wghttp started listening on 127.0.0.1:8080. I use PAC file for some sites. But for some reason it is not possible to use the IP of the machine in the local network (192.168.x.x) proxying does not work. --listen=192.168.x.x:8080 will work

Same issue when using in docker. Only localhost is available there, I can’t even specify the address of the machine

Unable to build on v0.3.3

Just pulled v0.3.3, can no longer build:

[pointy@pointy wghttp]$ git pull
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 11 (delta 5), reused 11 (delta 5), pack-reused 0
Unpacking objects: 100% (11/11), 2.57 KiB | 292.00 KiB/s, done.
From https://github.com/zhsj/wghttp
   7918f21..9378846  master     -> origin/master
 * [new tag]         v0.3.3     -> v0.3.3
Updating 7918f21..9378846
Fast-forward
 .github/workflows/ci.yaml | 12 ++++++------
 conn.go                   | 24 ++++++++++++++++--------
 go.mod                    | 14 +++++++-------
 go.sum                    | 28 ++++++++++++++--------------
 4 files changed, 43 insertions(+), 35 deletions(-)
[pointy@pointy wghttp]$ go install
go: downloading golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173
go: downloading golang.org/x/sys v0.12.0
go: downloading golang.org/x/net v0.15.0
go: downloading golang.org/x/crypto v0.13.0
go: downloading gvisor.dev/gvisor v0.0.0-20230927004350-cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:28:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:29:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:30:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:31:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:32:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:33:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:34:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:35:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:36:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:37:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:38:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
../../../.go/pkg/mod/golang.zx2c4.com/[email protected]/tun/netstack/tun.go:39:2: gvisor.dev/[email protected]: invalid version: unknown revision cbd86285d259
[pointy@pointy wghttp]$ go version
go version go1.22.2 linux/amd64

Thanks,
Elliott

keepalive-interval and another problem

Hello.

invalid argument for flag `/keepalive-interval' (expected time.Duration): time: missing unit in duration "20"

On the current version I get an infinite connection. Lots of tries: peer(jh1+…) - Sending handshake initiation
On the version of July 18, everything connects perfectly

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.