proxy support, fix 1.15 builds
This commit is contained in:
parent
48ad301517
commit
2724984b3b
7
Makefile
7
Makefile
|
@ -1,11 +1,12 @@
|
||||||
|
BUILDVARS := CGO_ENABLED=0
|
||||||
|
|
||||||
.PHONY: swarm
|
.PHONY: swarm
|
||||||
swarm:
|
swarm:
|
||||||
go build -o swarm cmd/swarm/main.go
|
$(BUILDVARS) go build -o swarm cmd/swarm/main.go
|
||||||
|
|
||||||
.PHONY: linux
|
.PHONY: linux
|
||||||
linux:
|
linux:
|
||||||
GOOS=linux GOARCH=amd64 go build -o swarm -ldflags '-w -s' cmd/swarm/main.go
|
$(BUILDVARS) GOOS=linux GOARCH=amd64 go build -o swarm cmd/swarm/main.go
|
||||||
#GOOS=linux GOARCH=amd64 go build -o swarm cmd/swarm/main.go
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
|
11
README.md
11
README.md
|
@ -3,14 +3,13 @@
|
||||||
## Building server binary
|
## Building server binary
|
||||||
|
|
||||||
```
|
```
|
||||||
# A stripped binary
|
|
||||||
# You need golang...
|
# You need golang...
|
||||||
go build -ldflags="-w -s" ./...
|
CGO_ENABLED=0 go build ./...
|
||||||
```
|
```
|
||||||
## Building docker
|
## Building docker
|
||||||
|
|
||||||
```
|
```
|
||||||
docker build -t antiroachlol
|
docker build -t antiroachlol
|
||||||
docker tag antiroachlol your.docker.endpoint.here/name
|
docker tag antiroachlol your.docker.endpoint.here/name
|
||||||
docker push 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
|
kubectl apply -f antiroach.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Run with proxy
|
||||||
|
|
||||||
|
```
|
||||||
|
ALL_PROXY=socks5://localhost:1243 ./swarm
|
||||||
|
```
|
||||||
|
|
|
@ -5,12 +5,12 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"golang.org/x/net/proxy"
|
||||||
irc "gopkg.in/irc.v3"
|
irc "gopkg.in/irc.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -36,7 +36,9 @@ func HandleRequest(ctx context.Context) (string, error) {
|
||||||
log.Fatal("Set IRC_VICTIM!")
|
log.Fatal("Set IRC_VICTIM!")
|
||||||
}
|
}
|
||||||
|
|
||||||
conn, err := net.Dial("tcp", server)
|
dialer := proxy.FromEnvironment()
|
||||||
|
|
||||||
|
conn, err := dialer.Dial("tcp", server)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -50,7 +52,6 @@ func HandleRequest(ctx context.Context) (string, error) {
|
||||||
client := irc.NewClient(conn, config)
|
client := irc.NewClient(conn, config)
|
||||||
err = client.Run()
|
err = client.Run()
|
||||||
return fmt.Sprintf("i died"), err
|
return fmt.Sprintf("i died"), err
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleIRCCon(c *irc.Client, m *irc.Message) {
|
func handleIRCCon(c *irc.Client, m *irc.Message) {
|
||||||
|
|
Loading…
Reference in New Issue