Compare commits

...

2 Commits

Author SHA1 Message Date
Teddysun
acef6b00a6
Added build_trojan-go-fork.sh 2023-11-15 20:55:50 +09:00
Teddysun
49ad970132
Update trojan-go 2023-11-15 20:52:50 +09:00
4 changed files with 179 additions and 114 deletions

View File

@ -1,10 +1,11 @@
# Dockerfile for trojan-go based alpine
# Copyright (C) 2019 - 2021 Teddysun <i@teddysun.com>
# Copyright (C) 2019 - 2023 Teddysun <i@teddysun.com>
# Reference URL:
# https://github.com/p4gefau1t/trojan-go
# https://github.com/v2fly/v2ray-core
# https://github.com/v2fly/geoip
# https://github.com/v2fly/domain-list-community
# https://github.com/Potterli20/trojan-go-fork
FROM --platform=${TARGETPLATFORM} alpine:latest
LABEL maintainer="Teddysun <i@teddysun.com>"

View File

@ -40,13 +40,20 @@ A sample in JSON like below:
"remote_addr": "127.0.0.1",
"remote_port": 80,
"password": [
"your_awesome_password"
"your_password"
],
"ssl": {
"cert": "server.crt",
"key": "server.key",
"sni": "your-domain-name.com",
"fallback_port": 1234
"cert": "your_cert.crt",
"key": "your_key.key",
"sni": "your-domain-name.com"
},
"router": {
"enabled": true,
"block": [
"geoip:private"
],
"geoip": "/usr/share/trojan-go/geoip.dat",
"geosite": "/usr/share/trojan-go/geosite.dat"
}
}
```

View File

@ -0,0 +1,55 @@
#!/bin/bash
#
# This is a Shell script for build multi-architectures trojan-go binary file
#
# Supported architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
#
# Copyright (C) 2020 - 2023 Teddysun <i@teddysun.com>
#
# Reference URL:
# https://github.com/p4gefau1t/trojan-go
# https://github.com/Potterli20/trojan-go-fork
cur_dir="$(pwd)"
COMMANDS=( git go )
for CMD in "${COMMANDS[@]}"; do
if [ ! "$(command -v "${CMD}")" ]; then
echo "${CMD} is not installed, please install it and try again" && exit 1
fi
done
cd ${cur_dir}
#version=$(wget --no-check-certificate -qO- https://api.github.com/repos/p4gefau1t/trojan-go/tags | grep 'name' | cut -d\" -f4 | head -1)
#echo "git clone -b ${version} https://github.com/p4gefau1t/trojan-go.git"
echo "git clone https://github.com/Potterli20/trojan-go-fork.git"
#git clone -b ${version} https://github.com/p4gefau1t/trojan-go.git
git clone https://github.com/Potterli20/trojan-go-fork.git
cd trojan-go-fork || exit 2
PACKAGE_NAME="github.com/Potterli20/trojan-go-fork"
VERSION="$(git describe --tags)"
# VERSION="v2023.11.15"
COMMIT="$(git rev-parse HEAD)"
VAR_SETTING="-X ${PACKAGE_NAME}/constant.Version=${VERSION} -X ${PACKAGE_NAME}/constant.Commit=${COMMIT}"
LDFLAGS="-s -w ${VAR_SETTING} -buildid="
ARCHS=( 386 amd64 arm arm64 ppc64le s390x )
ARMS=( 6 7 )
for ARCH in ${ARCHS[@]}; do
if [ "${ARCH}" = "arm" ]; then
for V in ${ARMS[@]}; do
echo "Building trojan-go_linux_${ARCH}${V}"
env CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GOARM=${V} go build -v -tags "full" -ldflags "${LDFLAGS}" -o ${cur_dir}/trojan-go_linux_${ARCH}${V}
done
else
echo "Building trojan-go_linux_${ARCH}"
env CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -v -tags "full" -ldflags "${LDFLAGS}" -o ${cur_dir}/trojan-go_linux_${ARCH}
fi
done
chmod +x ${cur_dir}/trojan-go_linux_*
# clean up
cd ${cur_dir} && rm -fr trojan-go-fork

View File

@ -12,10 +12,12 @@
"key": "your_key.key",
"sni": "your-domain-name.com"
},
"router":{
"router": {
"enabled": true,
"block": [
"geoip:private"
]
],
"geoip": "/usr/share/trojan-go/geoip.dat",
"geosite": "/usr/share/trojan-go/geosite.dat"
}
}