2022-04-13 14:04:40 +08:00
|
|
|
#!/bin/bash
|
|
|
|
#try to connect to google to determine whether user need to use proxy
|
2022-09-22 22:14:25 +08:00
|
|
|
curl www.google.com -o /dev/null --connect-timeout 5 2> /dev/null
|
2022-04-13 14:04:40 +08:00
|
|
|
if [ $? == 0 ]
|
|
|
|
then
|
2022-05-07 20:56:12 +08:00
|
|
|
echo "Successfully connected to Google, no need to use Go proxy"
|
2022-04-13 14:04:40 +08:00
|
|
|
else
|
2022-05-07 20:56:12 +08:00
|
|
|
echo "Google is blocked, Go proxy is enabled: GOPROXY=https://goproxy.cn,direct"
|
2022-09-05 23:17:39 +08:00
|
|
|
export GOPROXY="https://goproxy.cn,direct"
|
2022-05-07 20:56:12 +08:00
|
|
|
fi
|
2024-05-25 19:22:49 +02:00
|
|
|
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o server_linux_amd64 .
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-w -s" -o server_linux_arm64 .
|