Browse Source

update: some adjustments

master
dnomd343 3 years ago
parent
commit
e5448123ec
  1. 4
      Dockerfile
  2. 2
      asset.sh
  3. 46
      load.sh
  4. 4
      tproxy.sh

4
Dockerfile

@ -1,6 +1,6 @@
FROM alpine as asset
COPY ./asset.sh /
RUN apk --update add --no-cache curl wget && \
RUN apk --update add --no-cache curl wget jq && \
sh /asset.sh
FROM alpine
@ -10,7 +10,5 @@ COPY --from=asset /tmp/xray/xray /usr/bin/
ENV XRAY_LOCATION_ASSET=/etc/xray/asset
RUN apk --update add --no-cache iptables ip6tables && \
mkdir -p /etc/xray/config && \
mkdir -p /etc/xray/expose/log && \
mkdir -p /etc/xray/expose/segment && \
mv /etc/xray/tproxy.sh /
CMD ["sh","/tproxy.sh"]

2
asset.sh

@ -1,5 +1,5 @@
get_github_latest_version() {
VERSION=$(curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/');
VERSION=$(curl --silent "https://api.github.com/repos/$1/releases/latest" | jq | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/');
}
get_architecture() {

46
load.sh

@ -14,8 +14,8 @@ legal=false
[ "$log_level" == "none" ] && legal=true
[ "$legal" == false ] && log_level="warning"
if [ "$log_level" != "none" ]; then
[ ! -s "$LOG_DIR/access.log" ] && touch $LOG_DIR/access.log
[ ! -s "$LOG_DIR/error.log" ] && touch $LOG_DIR/error.log
[ ! -f "$LOG_DIR/access.log" ] && touch $LOG_DIR/access.log
[ ! -f "$LOG_DIR/error.log" ] && touch $LOG_DIR/error.log
fi
cat>$XRAY_DIR/config/log.json<<EOF
{
@ -103,21 +103,6 @@ cat>$XRAY_DIR/config/inbounds.json<<EOF
"tls"
]
}
},
{
"tag": "proxy",
"port": 10808,
"protocol": "socks",
"settings": {
"udp": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
]
}
@ -142,7 +127,8 @@ cat>$CONFIG_DIR/outbounds.json<<EOF
"outbounds": [
{
"tag": "node",
"protocol": "freedom"
"protocol": "freedom",
"settings": {}
}
]
}
@ -155,13 +141,6 @@ cat>$CONFIG_DIR/routing.json<<EOF
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"inboundTag": [
"proxy"
],
"outboundTag": "node"
},
{
"type": "field",
"network": "tcp,udp",
@ -221,6 +200,14 @@ FORWARD=true
EOF
}
init_dns(){
cat /dev/null > /etc/resolv.conf
while read -r row
do
echo "nameserver $row" >> /etc/resolv.conf
done < $NETWORK_DIR/dns
}
init_network(){
ifconfig eth0 down
ip -4 addr flush dev eth0
@ -264,19 +251,10 @@ if [ -n "$ipv6_forward" ]; then
fi
}
init_dns(){
cat /dev/null > /etc/resolv.conf
while read -r row
do
echo "nameserver $row" >> /etc/resolv.conf
done < $NETWORK_DIR/dns
}
mkdir -p $LOG_DIR
mkdir -p $ASSET_DIR
mkdir -p $CONFIG_DIR
mkdir -p $NETWORK_DIR
mkdir -p $XRAY_DIR/config
load_log
load_inbounds

4
tproxy.sh

@ -1,8 +1,8 @@
[ -f "/etc/xray/expose/custom.sh" ] && sh /etc/xray/expose/custom.sh
sh /etc/xray/load.sh
ip rule add fwmark 1 table 100
ip route add local 0.0.0.0/0 dev lo table 100
ip -4 rule add fwmark 1 table 100
ip -4 route add local 0.0.0.0/0 dev lo table 100
iptables -t mangle -N XRAY
ip -4 addr | grep -w "inet" | awk '{print $2}' > /ipv4_range
while read -r segment

Loading…
Cancel
Save