mirror of
https://github.com/teddysun/across.git
synced 2025-01-19 06:19:35 +08:00
Compare commits
1 Commits
9b0c0c367b
...
596aaa9077
Author | SHA1 | Date | |
---|---|---|---|
|
596aaa9077 |
@ -1,31 +1,30 @@
|
|||||||
# Dockerfile for trojan-go based alpine
|
# Dockerfile for trojan-go based alpine
|
||||||
# Copyright (C) 2019 - 2023 Teddysun <i@teddysun.com>
|
# Copyright (C) 2019 - 2021 Teddysun <i@teddysun.com>
|
||||||
# Reference URL:
|
# Reference URL:
|
||||||
# https://github.com/p4gefau1t/trojan-go
|
# https://github.com/p4gefau1t/trojan-go
|
||||||
# https://github.com/v2fly/v2ray-core
|
# https://github.com/v2fly/v2ray-core
|
||||||
# https://github.com/v2fly/geoip
|
# https://github.com/v2fly/geoip
|
||||||
# https://github.com/v2fly/domain-list-community
|
# https://github.com/v2fly/domain-list-community
|
||||||
# https://github.com/Potterli20/trojan-go-fork
|
|
||||||
|
FROM --platform=${TARGETPLATFORM} alpine:latest
|
||||||
FROM --platform=${TARGETPLATFORM} alpine:latest
|
LABEL maintainer="Teddysun <i@teddysun.com>"
|
||||||
LABEL maintainer="Teddysun <i@teddysun.com>"
|
|
||||||
|
ARG TARGETPLATFORM
|
||||||
ARG TARGETPLATFORM
|
COPY trojan-go.sh /root/trojan-go.sh
|
||||||
COPY trojan-go.sh /root/trojan-go.sh
|
COPY config.json /etc/trojan-go/config.json
|
||||||
COPY config.json /etc/trojan-go/config.json
|
RUN set -ex \
|
||||||
RUN set -ex \
|
&& apk add --no-cache tzdata ca-certificates \
|
||||||
&& apk add --no-cache tzdata ca-certificates \
|
&& chmod +x /root/trojan-go.sh \
|
||||||
&& chmod +x /root/trojan-go.sh \
|
&& /root/trojan-go.sh "${TARGETPLATFORM}" \
|
||||||
&& /root/trojan-go.sh "${TARGETPLATFORM}" \
|
&& rm -fv /root/trojan-go.sh \
|
||||||
&& rm -fv /root/trojan-go.sh \
|
&& mkdir -p /usr/share/trojan-go \
|
||||||
&& mkdir -p /usr/share/trojan-go \
|
&& wget -O /usr/share/trojan-go/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat \
|
||||||
&& wget -O /usr/share/trojan-go/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat \
|
&& wget -O /usr/share/trojan-go/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat \
|
||||||
&& wget -O /usr/share/trojan-go/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat \
|
&& wget -O /usr/share/trojan-go/geoip-only-cn-private.dat https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat \
|
||||||
&& wget -O /usr/share/trojan-go/geoip-only-cn-private.dat https://github.com/v2fly/geoip/releases/latest/download/geoip-only-cn-private.dat \
|
&& ln -fs /usr/share/trojan-go/geoip.dat /usr/bin/ \
|
||||||
&& ln -fs /usr/share/trojan-go/geoip.dat /usr/bin/ \
|
&& ln -fs /usr/share/trojan-go/geoip-only-cn-private.dat /usr/bin/ \
|
||||||
&& ln -fs /usr/share/trojan-go/geoip-only-cn-private.dat /usr/bin/ \
|
&& ln -fs /usr/share/trojan-go/geosite.dat /usr/bin/
|
||||||
&& ln -fs /usr/share/trojan-go/geosite.dat /usr/bin/
|
|
||||||
|
VOLUME /etc/trojan-go
|
||||||
VOLUME /etc/trojan-go
|
ENV TZ=Asia/Shanghai
|
||||||
ENV TZ=Asia/Shanghai
|
CMD [ "/usr/bin/trojan-go", "-config", "/etc/trojan-go/config.json" ]
|
||||||
CMD [ "/usr/bin/trojan-go", "-config", "/etc/trojan-go/config.json" ]
|
|
||||||
|
@ -1,72 +1,65 @@
|
|||||||
## Trojan-Go Docker Image by Teddysun
|
## Trojan-Go Docker Image by Teddysun
|
||||||
|
|
||||||
[Trojan-Go][1] is An unidentifiable mechanism that helps you bypass [GFW](https://en.wikipedia.org/wiki/Great_Firewall).
|
[Trojan-Go][1] is An unidentifiable mechanism that helps you bypass [GFW](https://en.wikipedia.org/wiki/Great_Firewall).
|
||||||
|
|
||||||
Trojan-Go features multiple protocols over `TLS` to avoid both active/passive detections and ISP `QoS` limitations.
|
Trojan-Go features multiple protocols over `TLS` to avoid both active/passive detections and ISP `QoS` limitations.
|
||||||
|
|
||||||
Docker images are built for quick deployment in various computing cloud providers.
|
Docker images are built for quick deployment in various computing cloud providers.
|
||||||
|
|
||||||
For more information on docker and containerization technologies, refer to [official document][2].
|
For more information on docker and containerization technologies, refer to [official document][2].
|
||||||
|
|
||||||
## Prepare the host
|
## Prepare the host
|
||||||
|
|
||||||
If you need to install docker by yourself, follow the [official installation guide][3].
|
If you need to install docker by yourself, follow the [official installation guide][3].
|
||||||
|
|
||||||
## Pull the image
|
## Pull the image
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker pull teddysun/trojan-go
|
$ docker pull teddysun/trojan-go
|
||||||
```
|
```
|
||||||
|
|
||||||
This pulls the latest release of trojan-go.
|
This pulls the latest release of trojan-go.
|
||||||
|
|
||||||
It can be found at [Docker Hub][4].
|
It can be found at [Docker Hub][4].
|
||||||
|
|
||||||
## Start a container
|
## Start a container
|
||||||
|
|
||||||
You **must create a configuration file** `/etc/trojan-go/config.json` in host at first:
|
You **must create a configuration file** `/etc/trojan-go/config.json` in host at first:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ mkdir -p /etc/trojan-go
|
$ mkdir -p /etc/trojan-go
|
||||||
```
|
```
|
||||||
|
|
||||||
A sample in JSON like below:
|
A sample in JSON like below:
|
||||||
|
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
"run_type": "server",
|
"run_type": "server",
|
||||||
"local_addr": "0.0.0.0",
|
"local_addr": "0.0.0.0",
|
||||||
"local_port": 443,
|
"local_port": 443,
|
||||||
"remote_addr": "127.0.0.1",
|
"remote_addr": "127.0.0.1",
|
||||||
"remote_port": 80,
|
"remote_port": 80,
|
||||||
"password": [
|
"password": [
|
||||||
"your_password"
|
"your_awesome_password"
|
||||||
],
|
],
|
||||||
"ssl": {
|
"ssl": {
|
||||||
"cert": "your_cert.crt",
|
"cert": "server.crt",
|
||||||
"key": "your_key.key",
|
"key": "server.key",
|
||||||
"sni": "your-domain-name.com"
|
"sni": "your-domain-name.com",
|
||||||
},
|
"fallback_port": 1234
|
||||||
"router": {
|
}
|
||||||
"enabled": true,
|
}
|
||||||
"block": [
|
```
|
||||||
"geoip:private"
|
|
||||||
],
|
An online documentation can be found [here](https://p4gefau1t.github.io/trojan-go/)
|
||||||
"geoip": "/usr/share/trojan-go/geoip.dat",
|
|
||||||
"geosite": "/usr/share/trojan-go/geosite.dat"
|
There is an example to start a container that use host network, run as a trojan-go server like below:
|
||||||
}
|
|
||||||
}
|
```bash
|
||||||
```
|
$ docker run -d --network host --name trojan-go --restart=always -v /etc/trojan-go:/etc/trojan-go teddysun/trojan-go
|
||||||
|
```
|
||||||
An online documentation can be found [here](https://p4gefau1t.github.io/trojan-go/)
|
|
||||||
|
[1]: https://github.com/p4gefau1t/trojan-go
|
||||||
There is an example to start a container that use host network, run as a trojan-go server like below:
|
[2]: https://docs.docker.com/
|
||||||
|
[3]: https://docs.docker.com/install/
|
||||||
```bash
|
|
||||||
$ docker run -d --network host --name trojan-go --restart=always -v /etc/trojan-go:/etc/trojan-go teddysun/trojan-go
|
|
||||||
```
|
|
||||||
|
|
||||||
[1]: https://github.com/p4gefau1t/trojan-go
|
|
||||||
[2]: https://docs.docker.com/
|
|
||||||
[3]: https://docs.docker.com/install/
|
|
||||||
[4]: https://hub.docker.com/r/teddysun/trojan-go/
|
[4]: https://hub.docker.com/r/teddysun/trojan-go/
|
@ -1,55 +0,0 @@
|
|||||||
#!/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
|
|
@ -1,23 +1,21 @@
|
|||||||
{
|
{
|
||||||
"run_type": "server",
|
"run_type": "server",
|
||||||
"local_addr": "0.0.0.0",
|
"local_addr": "0.0.0.0",
|
||||||
"local_port": 443,
|
"local_port": 443,
|
||||||
"remote_addr": "127.0.0.1",
|
"remote_addr": "127.0.0.1",
|
||||||
"remote_port": 80,
|
"remote_port": 80,
|
||||||
"password": [
|
"password": [
|
||||||
"your_password"
|
"your_password"
|
||||||
],
|
],
|
||||||
"ssl": {
|
"ssl": {
|
||||||
"cert": "your_cert.crt",
|
"cert": "your_cert.crt",
|
||||||
"key": "your_key.key",
|
"key": "your_key.key",
|
||||||
"sni": "your-domain-name.com"
|
"sni": "your-domain-name.com"
|
||||||
},
|
},
|
||||||
"router": {
|
"router":{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"block": [
|
"block": [
|
||||||
"geoip:private"
|
"geoip:private"
|
||||||
],
|
]
|
||||||
"geoip": "/usr/share/trojan-go/geoip.dat",
|
}
|
||||||
"geosite": "/usr/share/trojan-go/geosite.dat"
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user