Skip to content

Commit

Permalink
Update plugin-share-profile-to-phone
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayideyia committed Dec 4, 2024
1 parent 92afd0d commit 75ba748
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions plugins/GFS/plugin-share-profile-to-phone.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ const onRun = async () => {
// 新配置
else {
// * 开启TUN
const tun = _profile.inbounds.find((v) => v.type === 'tun')
if (tun) {
tun.enable = true
} else {
_profile.inbounds.push({
let tun = _profile.inbounds.find((v) => v.type === 'tun')
const mixed = _profile.inbounds.find((v) => v.type === 'mixed')
const http = _profile.inbounds.find((v) => v.type === 'http')
if (!tun) {
tun = {
id: Plugins.sampleID(),
type: 'tun',
tag: 'tun-in',
Expand All @@ -62,7 +62,26 @@ const onRun = async () => {
endpoint_independent_nat: false,
stack: 'mixed'
}
})
}
_profile.inbounds.push(tun)
}
tun.enable = true
if (mixed) {
tun.tun.platform = {
http_proxy: {
enabled: false,
server: '127.0.0.1',
server_port: mixed.mixed.listen.listen_port
}
}
} else if (http) {
tun.tun.platform = {
http_proxy: {
enabled: false,
server: '127.0.0.1',
server_port: http.http.listen.listen_port
}
}
}
// * 替换本地规则集为远程规则集(仅从规则集中心添加的可替换)
_profile.route.rule_set.forEach((ruleset) => {
Expand Down

0 comments on commit 75ba748

Please sign in to comment.