Skip to content

Commit

Permalink
feat: update NETunnelProviderProtocol+Ext.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajhilje committed Sep 19, 2023
1 parent 2296d04 commit a5ff2d1
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ extension NETunnelProviderProtocol {
var publicKey = host.publicKey
let port = getPort(settings: settings)
var endpoint = Peer.endpoint(host: host.host, port: port)
var v2raySettings = V2RaySettings.load()
var v2rayInboundIp = host.host
var v2rayInboundPort = v2raySettings?.singleHopInboundPort ?? 0
let v2rayOutboundIp = host.v2ray
let v2rayOutboundPort = port
let v2rayDnsName = host.dnsName
Expand All @@ -135,6 +137,7 @@ extension NETunnelProviderProtocol {
publicKey = exitHost.publicKey
endpoint = Peer.endpoint(host: host.host, port: exitHost.multihopPort)
v2rayInboundIp = exitHost.host
v2rayInboundPort = exitHost.multihopPort
}

if let ipv6 = host.ipv6, UserDefaults.shared.isIPv6 {
Expand All @@ -146,13 +149,12 @@ extension NETunnelProviderProtocol {
// If V2Ray is enabled
if (false) {
endpoint = Peer.endpoint(host: Config.v2rayHost, port: Config.v2rayPort)
if var v2raySettings = V2RaySettings.load() {
v2raySettings.inboundIp = v2rayInboundIp
v2raySettings.outboundIp = v2rayOutboundIp
v2raySettings.outboundPort = v2rayOutboundPort
v2raySettings.dnsName = v2rayDnsName
v2raySettings.save()
}
v2raySettings?.inboundIp = v2rayInboundIp
v2raySettings?.inboundPort = v2rayInboundPort
v2raySettings?.outboundIp = v2rayOutboundIp
v2raySettings?.outboundPort = v2rayOutboundPort
v2raySettings?.dnsName = v2rayDnsName
v2raySettings?.save()
}

let peer = Peer(
Expand Down

0 comments on commit a5ff2d1

Please sign in to comment.