-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c63a588
commit 9818704
Showing
8 changed files
with
11,355 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/* | ||
out/* | ||
Tunnel/xray | ||
Tunnel/tun2socks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pkill -f "tun2socks" | ||
ip tuntap del dev tun0 mode tun | ||
# ip route del $xray_ip via $def_gate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
#variables | ||
host_name=$1 | ||
xray_ip=$(dig +short $host_name) | ||
def_gate=$(ip r | grep 'default' | awk '{print$3}') # This will output your default gateway ip address . if command fails try finding the deault gateway ip by using 'ip r' command | ||
|
||
ip tuntap del dev tun0 mode tun user tun2socks | ||
ip route del $xray_ip via $def_gate | ||
|
||
ip tuntap add dev tun0 mode tun user tun2socks | ||
ip addr add 10.0.0.1/24 dev tun0 | ||
ip addr add fdfe:dcba:9876::1/125 dev tun0 | ||
ip route add $xray_ip via $def_gate | ||
ip link set tun0 up | ||
ip -6 link set tun0 up | ||
ip route add default dev tun0 | ||
ip -6 route add default dev tun0 | ||
|
||
chmod +x tun2socks | ||
$2/xray -c $3 > /dev/null & | ||
# sleep 2 | ||
|
||
# insert/update hosts entry | ||
ip_address=$xray_ip | ||
# find existing instances in the host file and save the line numbers | ||
suffix="XrayTun.linux" | ||
matches_in_hosts="$(grep -n "$suffix" /etc/hosts | cut -f1 -d:)" | ||
|
||
host_entry="${ip_address} ${host_name} ${suffix}" | ||
|
||
echo "Please enter your password if requested." | ||
|
||
if [ ! -z "$matches_in_hosts" ] | ||
then | ||
echo "Updating existing hosts entry." | ||
# iterate over the line numbers on which matches were found | ||
while read -r line_number; do | ||
# replace the text of each line with the desired host entry | ||
sudo sed -i "${line_number}s/.*/${host_entry} /" /etc/hosts | ||
done <<< "$matches_in_hosts" | ||
else | ||
echo "Adding new hosts entry." | ||
echo "$host_entry" | sudo tee -a /etc/hosts > /dev/null | ||
fi | ||
|
||
|
||
$2/tun2socks -device tun://tun0 -proxy socks5://127.0.0.1:10808 # you can define the local socks5 port here 10808 is the default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
packagerConfig: {}, | ||
rebuildConfig: {}, | ||
makers: [ | ||
{ | ||
name: '@electron-forge/maker-deb', | ||
config: {}, | ||
} | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous"> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/js/bootstrap.bundle.min.js" integrity="sha512-i9cEfJwUwViEPFKdC1enz4ZRGBj8YQo6QByFTF92YXHi7waCqyexvRD75S5NVTsSiTv7rKWqG9Y5eFxmRsOn0A==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> | ||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'"> | ||
<title>V2Box</title> | ||
</head> | ||
<body> | ||
<div class="container p-5"> | ||
<div class="row"> | ||
<Label>config.json</Label> | ||
<textarea name="config" id="config" cols="30" rows="10"></textarea> | ||
<Label>server address or IP</Label> | ||
<input type="text" id="serverAddress"> | ||
<input type="button" id="button" value="Start Xray" class="mt-5"> | ||
</div> | ||
|
||
</div> | ||
</body> | ||
<script src="./renderer.js"></script> | ||
</html> | ||
|
||
|
Oops, something went wrong.