Browse Source

proxy support, fix 1.15 builds

master
dave 3 months ago
parent
commit
2724984b3b
3 changed files with 16 additions and 9 deletions
  1. +4
    -3
      Makefile
  2. +8
    -3
      README.md
  3. +4
    -3
      cmd/swarm/main.go

+ 4
- 3
Makefile View File

@@ -1,11 +1,12 @@
BUILDVARS := CGO_ENABLED=0

.PHONY: swarm
swarm:
go build -o swarm cmd/swarm/main.go
$(BUILDVARS) go build -o swarm cmd/swarm/main.go

.PHONY: linux
linux:
GOOS=linux GOARCH=amd64 go build -o swarm -ldflags '-w -s' cmd/swarm/main.go
#GOOS=linux GOARCH=amd64 go build -o swarm cmd/swarm/main.go
$(BUILDVARS) GOOS=linux GOARCH=amd64 go build -o swarm cmd/swarm/main.go

.PHONY: clean
clean:


+ 8
- 3
README.md View File

@@ -3,14 +3,13 @@
## Building server binary

```
# A stripped binary
# You need golang...
go build -ldflags="-w -s" ./...
CGO_ENABLED=0 go build ./...
```
## Building docker

```
docker build -t antiroachlol
docker build -t antiroachlol
docker tag antiroachlol your.docker.endpoint.here/name
docker push your.docker.endpoint.here/name

@@ -22,3 +21,9 @@ Edit `antiroach.yml` to match the docker name and desired replicas you put above
```
kubectl apply -f antiroach.yml
```

## Run with proxy

```
ALL_PROXY=socks5://localhost:1243 ./swarm
```

+ 4
- 3
cmd/swarm/main.go View File

@@ -5,12 +5,12 @@ import (
"fmt"
"log"
"math/rand"
"net"
"os"
"strconv"
"strings"
"time"

"golang.org/x/net/proxy"
irc "gopkg.in/irc.v3"
)

@@ -36,7 +36,9 @@ func HandleRequest(ctx context.Context) (string, error) {
log.Fatal("Set IRC_VICTIM!")
}

conn, err := net.Dial("tcp", server)
dialer := proxy.FromEnvironment()

conn, err := dialer.Dial("tcp", server)
if err != nil {
log.Fatal(err)
}
@@ -50,7 +52,6 @@ func HandleRequest(ctx context.Context) (string, error) {
client := irc.NewClient(conn, config)
err = client.Run()
return fmt.Sprintf("i died"), err

}

func handleIRCCon(c *irc.Client, m *irc.Message) {


Loading…
Cancel
Save