pufferffish / wireproxy

Wireguard client that exposes itself as a socks5 proxy
ISC License
4.54k stars 272 forks source link

Error compiling build constraints error in gvisor #89

Open lockevod opened 1 year ago

lockevod commented 1 year ago

Hello I'm triying to compile (Macos Ventura M2 chip)

I have this error

imports gvisor.dev/gvisor/pkg/gohacks: build constraints exclude all Go files in /Users/sergi/go/pkg/mod/gvisor.dev/gvisor@v0.0.0-20221203005347-703fd9b7fbc0/pkg/gohacks

Thanks

PThorpe92 commented 1 year ago

Same issue here

SuperCoolAlan commented 1 year ago

Same here, building for Linux x86

qwerty12 commented 1 year ago

I just built this from Git master on both Windows x64 and Android ARM64 (Go 1.21.1 and 1.21.0 via Termux respectively). Quick instructions:

  1. Clone this repository somewhere
  2. In the wireproxy folder, git clone https://git.zx2c4.com/wireguard-go
  3. Apply this patch to wireguard-go:

    
    diff --git a/tun/netstack/tun.go b/tun/netstack/tun.go
    index 596cfcd..bff5d15 100644
    --- a/tun/netstack/tun.go
    +++ b/tun/netstack/tun.go
    @@ -25,7 +25,7 @@ import (
    "golang.zx2c4.com/wireguard/tun"
    
    "golang.org/x/net/dns/dnsmessage"
    -   "gvisor.dev/gvisor/pkg/bufferv2"
    +   "gvisor.dev/gvisor/pkg/buffer"
    "gvisor.dev/gvisor/pkg/tcpip"
    "gvisor.dev/gvisor/pkg/tcpip/adapters/gonet"
    "gvisor.dev/gvisor/pkg/tcpip/header"
    @@ -43,7 +43,7 @@ type netTun struct {
    ep             *channel.Endpoint
    stack          *stack.Stack
    events         chan tun.Event
    -   incomingPacket chan *bufferv2.View
    +   incomingPacket chan *buffer.View
    mtu            int
    dnsServers     []netip.Addr
    hasV4, hasV6   bool
    @@ -61,7 +61,7 @@ func CreateNetTUN(localAddresses, dnsServers []netip.Addr, mtu int) (tun.Device,
        ep:             channel.New(1024, uint32(mtu), ""),
        stack:          stack.New(opts),
        events:         make(chan tun.Event, 10),
    -       incomingPacket: make(chan *bufferv2.View),
    +       incomingPacket: make(chan *buffer.View),
        dnsServers:     dnsServers,
        mtu:            mtu,
    }
    @@ -84,7 +84,7 @@ func CreateNetTUN(localAddresses, dnsServers []netip.Addr, mtu int) (tun.Device,
        }
        protoAddr := tcpip.ProtocolAddress{
            Protocol:          protoNumber,
    -           AddressWithPrefix: tcpip.Address(ip.AsSlice()).WithPrefix(),
    +           AddressWithPrefix: tcpip.AddrFromSlice(ip.AsSlice()).WithPrefix(),
        }
        tcpipErr := dev.stack.AddProtocolAddress(1, protoAddr, stack.AddressProperties{})
        if tcpipErr != nil {
    @@ -140,7 +140,7 @@ func (tun *netTun) Write(buf [][]byte, offset int) (int, error) {
            continue
        }
4. Update all the dependencies in wireproxy's go.mod. I don't know how to do this myself; I opened the repo in VS Code with the Go extension installed and just clicked the upgrade buttons in go.mod as much as I could 🤷‍♂️ 
5. In the same go.mod, replace the `gvisor.dev/gvisor v0.0.0-20221203005347-703fd9b7fbc0 // indirect` (or similar) line with `gvisor.dev/gvisor v0.0.0-20230928000133-4fe30062272c // indirect` and add this at the bottom of the file:

// https://github.com/google/gvisor/tree/go replace gvisor.dev/gvisor => github.com/google/gvisor v0.0.0-20230928000133-4fe30062272c replace golang.zx2c4.com/wireguard => ./wireguard-go



6. Run `go mod tidy` or whatever command it is that reconciles go.sum with go.mod
7. Try building with the Makefile and if I didn't forget anything here, you didn't mess anything up, and the upstream Go libraries remain relatively the same since the posting of this comment, you might also be able to enjoy a fresh wireproxy binary.
hemidark commented 1 year ago

Also having this problem. It'd be interesting to see a go.sum left over from someone's working build.