mirror of
https://github.com/teddysun/across.git
synced 2025-01-19 06:19:35 +08:00
Merge 99668d9c3e24775678dd6596f86aa39257ef3ee5 into 118cdb138aaf5173da66ebef6467c5e896fbe40f
This commit is contained in:
commit
4eea4386a2
@ -24,13 +24,13 @@ It can be found at [Docker Hub][4].
|
||||
|
||||
You **must create a configuration file** `/etc/hysteria/server.yaml` in host at first:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ mkdir -p /etc/hysteria
|
||||
```
|
||||
|
||||
A sample in yaml like below:
|
||||
|
||||
```
|
||||
```yaml
|
||||
listen: :8998
|
||||
|
||||
tls:
|
||||
@ -56,6 +56,60 @@ There is an example to start a container that listen on port `8998`, run as a Hy
|
||||
$ docker run -d -p 8998:8998 --name hysteria --restart=always -v /etc/hysteria:/etc/hysteria teddysun/hysteria
|
||||
```
|
||||
|
||||
## Start a container as Hysteria client with socks proxy
|
||||
|
||||
## Pull the image
|
||||
|
||||
```bash
|
||||
$ docker pull teddysun/hysteria-client
|
||||
```
|
||||
|
||||
You **must create a configuration file** `/etc/hysteria/client.yaml` in host at first:
|
||||
|
||||
```bash
|
||||
$ mkdir -p /etc/hysteria
|
||||
```
|
||||
|
||||
A sample in yaml like below:
|
||||
|
||||
```yaml
|
||||
server: "IP:8998"
|
||||
# server: "IP:8998,10000-20000" port hopping is availiable
|
||||
|
||||
auth: your_password
|
||||
|
||||
tls:
|
||||
sni: www.example.com
|
||||
# sni: www.bing.com
|
||||
insecure: true
|
||||
|
||||
#need expose socks proxy server port
|
||||
socks5:
|
||||
listen: 0.0.0.0:1080
|
||||
disableUDP: false
|
||||
|
||||
transport:
|
||||
udp:
|
||||
hopInterval: 30s
|
||||
|
||||
#optional
|
||||
#lazy: true
|
||||
#bandwidth:
|
||||
#up: 150 mbps
|
||||
#down: 150 mbps
|
||||
# quic:
|
||||
# initStreamReceiveWindow: 16777216
|
||||
# maxStreamReceiveWindow: 16777216
|
||||
# initConnReceiveWindow: 33554432
|
||||
# maxConnReceiveWindow: 33554432
|
||||
```
|
||||
There is an example to start a container that listen on port `1080`, run as a Hysteria client like below:
|
||||
|
||||
```bash
|
||||
$ docker run -d -p 1080:1080 --name hysteria-client --restart=always -v /etc/hysteria:/etc/hysteria teddysun/hysteria-client
|
||||
```
|
||||
Then access socks server with `client_hostIP:1080`
|
||||
|
||||
**Warning**: The port number must be same as configuration and opened in firewall.
|
||||
|
||||
[1]: https://github.com/apernet/hysteria
|
||||
|
21
docker/hysteria/client/Dockerfile.architecture
Normal file
21
docker/hysteria/client/Dockerfile.architecture
Normal file
@ -0,0 +1,21 @@
|
||||
# Dockerfile for hysteria client based alpine
|
||||
# Copyright (C) 2023 Teddysun <i@teddysun.com>
|
||||
# Reference URL:
|
||||
# https://github.com/HyNetwork/hysteria
|
||||
|
||||
FROM --platform=${TARGETPLATFORM} alpine:latest
|
||||
LABEL maintainer="Teddysun <i@teddysun.com>"
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
WORKDIR /root
|
||||
COPY hysteria.sh /root/hysteria.sh
|
||||
COPY client.yaml /etc/hysteria/client.yaml
|
||||
RUN set -ex \
|
||||
&& apk add --no-cache bash tzdata ca-certificates \
|
||||
&& chmod +x /root/hysteria.sh \
|
||||
&& /root/hysteria.sh "${TARGETPLATFORM}" \
|
||||
&& rm -fv /root/hysteria.sh
|
||||
|
||||
VOLUME /etc/hysteria
|
||||
ENV TZ=Asia/Shanghai
|
||||
CMD [ "/usr/bin/hysteria", "client", "-c", "/etc/hysteria/client.yaml" ]
|
55
docker/hysteria/client/build_hysteria.sh
Normal file
55
docker/hysteria/client/build_hysteria.sh
Normal file
@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This is a Shell script for build multi-architectures hysteria binary file
|
||||
#
|
||||
# Supported architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
|
||||
#
|
||||
# Copyright (C) 2022 - 2023 Teddysun <i@teddysun.com>
|
||||
#
|
||||
# Reference URL:
|
||||
# https://github.com/apernet/hysteria
|
||||
|
||||
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}
|
||||
echo "git clone https://github.com/apernet/hysteria.git"
|
||||
git clone https://github.com/apernet/hysteria.git
|
||||
cd hysteria || exit 2
|
||||
|
||||
APP_SRC_CMD_PKG="github.com/apernet/hysteria/app/cmd"
|
||||
VERSION="$(git describe)"
|
||||
COMMIT="$(git rev-parse HEAD)"
|
||||
TIMESTAMP="$(date "+%F")"
|
||||
|
||||
LDFLAGS="-s -w -X '${APP_SRC_CMD_PKG}.appVersion=${VERSION}' -X '${APP_SRC_CMD_PKG}.appCommit=${COMMIT}' -X '${APP_SRC_CMD_PKG}.appDate=${TIMESTAMP}' -X '${APP_SRC_CMD_PKG}.appType=release' -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 hysteria_linux_${ARCH}${V}"
|
||||
env CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GOARM=${V} go build -v -trimpath -ldflags "${LDFLAGS} -X '${APP_SRC_CMD_PKG}.appPlatform=linux' -X '${APP_SRC_CMD_PKG}.appArch=${ARCH}'" -o ${cur_dir}/hysteria_linux_${ARCH}${V} ./app || exit 1
|
||||
done
|
||||
else
|
||||
echo "Building hysteria_linux_${ARCH}"
|
||||
env CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -v -trimpath -ldflags "${LDFLAGS} -X '${APP_SRC_CMD_PKG}.appPlatform=linux' -X '${APP_SRC_CMD_PKG}.appArch=${ARCH}'" -o ${cur_dir}/hysteria_linux_${ARCH} ./app || exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
ARCHS=( 386 amd64 )
|
||||
for ARCH in ${ARCHS[@]}; do
|
||||
echo "Building hysteria_windows_${ARCH}.exe"
|
||||
env CGO_ENABLED=0 GOOS=windows GOARCH=${ARCH} go build -v -trimpath -ldflags "${LDFLAGS} -X '${APP_SRC_CMD_PKG}.appPlatform=windows' -X '${APP_SRC_CMD_PKG}.appArch=${ARCH}'" -o ${cur_dir}/hysteria_windows_${ARCH}.exe ./app
|
||||
done
|
||||
|
||||
chmod +x ${cur_dir}/hysteria_*
|
||||
# clean up
|
||||
cd ${cur_dir} && rm -fr hysteria
|
51
docker/hysteria/client/hysteria.sh
Normal file
51
docker/hysteria/client/hysteria.sh
Normal file
@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This is a Shell script for hysteria based alpine with Docker image
|
||||
#
|
||||
# Copyright (C) 2022 Teddysun <i@teddysun.com>
|
||||
#
|
||||
# Reference URL:
|
||||
# https://github.com/HyNetwork/hysteria
|
||||
|
||||
PLATFORM=$1
|
||||
if [ -z "$PLATFORM" ]; then
|
||||
ARCH="amd64"
|
||||
else
|
||||
case "$PLATFORM" in
|
||||
linux/386)
|
||||
ARCH="386"
|
||||
;;
|
||||
linux/amd64)
|
||||
ARCH="amd64"
|
||||
;;
|
||||
linux/arm/v6)
|
||||
ARCH="arm6"
|
||||
;;
|
||||
linux/arm/v7)
|
||||
ARCH="arm7"
|
||||
;;
|
||||
linux/arm64|linux/arm64/v8)
|
||||
ARCH="arm64"
|
||||
;;
|
||||
linux/ppc64le)
|
||||
ARCH="ppc64le"
|
||||
;;
|
||||
linux/s390x)
|
||||
ARCH="s390x"
|
||||
;;
|
||||
*)
|
||||
ARCH=""
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
[ -z "${ARCH}" ] && echo "Error: Not supported OS Architecture" && exit 1
|
||||
# Download binary file
|
||||
HYSTERIA_FILE="hysteria_linux_${ARCH}"
|
||||
|
||||
echo "Downloading binary file: ${HYSTERIA_FILE}"
|
||||
wget -O /usr/bin/hysteria https://dl.lamp.sh/files/${HYSTERIA_FILE} > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to download binary file: ${HYSTERIA_FILE}" && exit 1
|
||||
fi
|
||||
echo "Download binary file: ${HYSTERIA_FILE} completed"
|
||||
chmod +x /usr/bin/hysteria
|
Loading…
x
Reference in New Issue
Block a user