refactor docker

This commit is contained in:
Hiddify
2024-03-15 09:33:57 +01:00
parent 6303adc810
commit 7e21b935f8
3 changed files with 47 additions and 11 deletions

View File

@@ -40,6 +40,7 @@ type InboundOptions struct {
MTU uint32 `json:"mtu"` MTU uint32 `json:"mtu"`
StrictRoute bool `json:"strict-route"` StrictRoute bool `json:"strict-route"`
TUNStack string `json:"tun-implementation"` TUNStack string `json:"tun-implementation"`
TProxyPort uint16 `json:"tproxy-port"`
} }
type URLTestOptions struct { type URLTestOptions struct {
@@ -99,6 +100,7 @@ func DefaultConfigOptions() *ConfigOptions {
EnableTun: false, EnableTun: false,
SetSystemProxy: false, SetSystemProxy: false,
MixedPort: 2334, MixedPort: 2334,
TProxyPort: 2335,
LocalDnsPort: 16450, LocalDnsPort: 16450,
MTU: 9000, MTU: 9000,
StrictRoute: true, StrictRoute: true,

View File

@@ -1,18 +1,18 @@
FROM alpine:latest FROM alpine:latest
ENV CONFIG='https://raw.githubusercontent.com/ircfspace/warpsub/main/export/warp#WARP%20(IRCF)' ENV CONFIG='https://raw.githubusercontent.com/ircfspace/warpsub/main/export/warp#WARP%20(IRCF)'
ENV VERSION=0.17.8 ENV VERSION=v0.17.8
WORKDIR /hiddify WORKDIR /hiddify
RUN apk add wget tar gzip libc6-compat RUN apk add curl tar gzip libc6-compat # iptables ip6tables
RUN case "$(apk --print-arch)" in \ RUN case "$(apk --print-arch)" in \
x86_64) ARCH=amd64 ;; \ x86_64) ARCH=amd64 ;; \
i386) ARCH=386 ;; \ i386) ARCH=386 ;; \
armv7l) ARCH=arm ;; \ armv7l) ARCH=arm ;; \
aarch64) ARCH=arm64 ;; \ aarch64) ARCH=arm64 ;; \
*) echo "Unsupported architecture: $(apk --print-arch) $(uname -m)" && exit 1 ;; \ *) echo "Unsupported architecture: $(apk --print-arch) $(uname -m)" && exit 1 ;; \
esac && \ esac && \
curl -l -o hiddify-cli.tar.gz https://github.com/hiddify/hiddify-next-core/releases/download/${VERSION}/hiddify-cli-linux-$ARCH.tar.gz && \ curl -L -o hiddify-cli.tar.gz https://github.com/hiddify/hiddify-next-core/releases/download/${VERSION}/hiddify-cli-linux-$ARCH.tar.gz && \
tar -xzf hiddify-cli.tar.gz && rm hiddify-cli.tar.gz tar -xzf hiddify-cli.tar.gz && rm hiddify-cli.tar.gz
COPY hiddify.sh . COPY hiddify.sh .
RUN chmod +x hiddify.sh RUN chmod +x hiddify.sh
COPY hiddify.json ./data/ COPY hiddify.json ./data/

View File

@@ -1,6 +1,40 @@
#!/bin/sh #!/bin/sh
# sysctl -w net.ipv4.ip_forward=1
# sysctl -w net.ipv6.ip_forward=1
# ip rule add fwmark 1 table 100 ;
# ip route add local 0.0.0.0/0 dev lo table 100
# # CREATE TABLE
# iptables -t mangle -N hiddify
# # RETURN LOCAL AND LANS
# iptables -t mangle -A OUTPUT -j RETURN
# iptables -t nat -A hiddify --dport 2334 -j RETURN
# iptables -t mangle -A hiddify -d 10.0.0.0/8 -j RETURN
# iptables -t mangle -A hiddify -d 127.0.0.0/8 -j RETURN
# iptables -t mangle -A hiddify -d 169.254.0.0/16 -j RETURN
# iptables -t mangle -A hiddify -d 172.16.0.0/12 -j RETURN
# iptables -t mangle -A hiddify -d 192.168.50.0/16 -j RETURN
# iptables -t mangle -A hiddify -d 192.168.9.0/16 -j RETURN
# iptables -t mangle -A hiddify -d 224.0.0.0/4 -j RETURN
# iptables -t mangle -A hiddify -d 240.0.0.0/4 -j RETURN
# iptables -t mangle -A hiddify -p udp -j TPROXY --on-port 2334 --tproxy-mark 1
# iptables -t mangle -A hiddify -p tcp -j TPROXY --on-port 2334 --tproxy-mark 1
# # HIJACK ICMP (untested)
# # iptables -t mangle -A hiddify -p icmp -j DNAT --to-destination 127.0.0.1
# # REDIRECT
# iptables -t mangle -A PREROUTING -j hiddify
if [ -f "/opt/hiddify.json" ]; then if [ -f "/opt/hiddify.json" ]; then
/hiddify/HiddifyCli run --config "$CONFIG" -h /hiddify/data/hiddify.json /hiddify/HiddifyCli run --config "$CONFIG" -h /hiddify/data/hiddify.json
else else
/hiddify/HiddifyCli run --config "$CONFIG" /hiddify/HiddifyCli run --config "$CONFIG"
fi fi