Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
L
liberty-tunnel-client-library-apple
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liberty
tunnel
liberty-tunnel-client-library-apple
Commits
ee125793
Commit
ee125793
authored
Nov 18, 2020
by
Jose Blaya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor
parent
9f54f2d6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
17 deletions
+16
-17
PIALibrary/Sources/Core/WebServices/Server.swift
PIALibrary/Sources/Core/WebServices/Server.swift
+7
-10
PIALibrary/Sources/Library/VPN/IKEv2Profile.swift
PIALibrary/Sources/Library/VPN/IKEv2Profile.swift
+2
-2
PIALibrary/Sources/Library/WebServices/PIAWebServices.swift
PIALibrary/Sources/Library/WebServices/PIAWebServices.swift
+4
-2
PIALibrary/Sources/VPN/PIATunnelProfile.swift
PIALibrary/Sources/VPN/PIATunnelProfile.swift
+2
-2
PIALibrary/Sources/VPN/PIAWGTunnelProfile.swift
PIALibrary/Sources/VPN/PIAWGTunnelProfile.swift
+1
-1
No files found.
PIALibrary/Sources/Core/WebServices/Server.swift
View file @
ee125793
...
...
@@ -159,6 +159,8 @@ public class Server: Hashable {
public
let
dipToken
:
String
?
public
let
dipStatus
:
DedicatedIPStatus
?
public
let
dipUsername
:
String
?
var
isAutomatic
:
Bool
...
...
@@ -180,6 +182,7 @@ public class Server: Hashable {
dipExpire
:
Date
?
=
nil
,
dipToken
:
String
?
=
nil
,
dipStatus
:
DedicatedIPStatus
?
=
nil
,
dipUsername
:
String
?
=
nil
,
regionIdentifier
:
String
)
{
self
.
serial
=
serial
...
...
@@ -202,7 +205,8 @@ public class Server: Hashable {
self
.
dipExpire
=
dipExpire
self
.
dipToken
=
dipToken
self
.
dipStatus
=
dipStatus
self
.
dipUsername
=
dipUsername
isAutomatic
=
false
}
...
...
@@ -293,16 +297,9 @@ extension Server {
}
extension
Server
{
func
dipUsername
()
->
String
?
{
if
let
dipToken
=
dipToken
{
return
"dedicated_ip_"
+
dipToken
+
"_"
+
String
.
random
(
length
:
8
)
}
return
nil
}
func
dipPassword
()
->
Data
?
{
if
let
dipUsername
=
dip
Token
{
if
let
dipUsername
=
dip
Username
{
return
Client
.
database
.
secure
.
passwordReference
(
forDipToken
:
dipUsername
)
}
return
nil
...
...
PIALibrary/Sources/Library/VPN/IKEv2Profile.swift
View file @
ee125793
...
...
@@ -167,9 +167,9 @@ public class IKEv2Profile: NetworkExtensionProfile {
var
iKEv2Username
=
""
var
iKEv2Password
:
Data
?
if
let
dipUsername
=
configuration
.
server
.
dipUsername
()
{
//override the username if DIP
if
let
dipUsername
=
configuration
.
server
.
dipUsername
,
let
dipToken
=
configuration
.
server
.
dipToken
{
//override the username if DIP
iKEv2Username
=
dipUsername
iKEv2Password
=
Client
.
database
.
secure
.
passwordReference
(
forDipToken
:
dipUsername
)
iKEv2Password
=
configuration
.
server
.
dipPassword
(
)
}
else
{
if
let
username
=
Client
.
providers
.
accountProvider
.
token
{
iKEv2Username
=
username
...
...
PIALibrary/Sources/Library/WebServices/PIAWebServices.swift
View file @
ee125793
...
...
@@ -248,13 +248,15 @@ class PIAWebServices: WebServices, ConfigurationAccess {
let
status
=
DedicatedIPStatus
(
fromAPIStatus
:
dipServer
.
status
)
let
server
=
Server
.
ServerAddressIP
(
ip
:
ip
,
cn
:
cn
)
let
dipRegion
=
Server
(
serial
:
firstServer
.
serial
,
name
:
firstServer
.
name
,
country
:
firstServer
.
country
,
hostname
:
firstServer
.
hostname
,
openVPNAddressesForTCP
:
[
server
],
openVPNAddressesForUDP
:
[
server
],
wireGuardAddressesForUDP
:
[
server
],
iKEv2AddressesForUDP
:
[
server
],
pingAddress
:
firstServer
.
pingAddress
,
geo
:
false
,
meta
:
nil
,
dipExpire
:
expiringDate
,
dipToken
:
dipServer
.
dipToken
,
dipStatus
:
status
,
regionIdentifier
:
firstServer
.
regionIdentifier
)
let
dipUsername
=
"dedicated_ip_"
+
dipServer
.
dipToken
+
"_"
+
String
.
random
(
length
:
8
)
let
dipRegion
=
Server
(
serial
:
firstServer
.
serial
,
name
:
firstServer
.
name
,
country
:
firstServer
.
country
,
hostname
:
firstServer
.
hostname
,
openVPNAddressesForTCP
:
[
server
],
openVPNAddressesForUDP
:
[
server
],
wireGuardAddressesForUDP
:
[
server
],
iKEv2AddressesForUDP
:
[
server
],
pingAddress
:
firstServer
.
pingAddress
,
geo
:
false
,
meta
:
nil
,
dipExpire
:
expiringDate
,
dipToken
:
dipServer
.
dipToken
,
dipStatus
:
status
,
dipUsername
:
dipUsername
,
regionIdentifier
:
firstServer
.
regionIdentifier
)
dipRegions
.
append
(
dipRegion
)
if
status
==
.
active
{
Client
.
database
.
secure
.
setDIPToken
(
dipServer
.
dipToken
)
Client
.
database
.
secure
.
setPassword
(
ip
,
forDipToken
:
dip
Server
.
dipToken
)
Client
.
database
.
secure
.
setPassword
(
ip
,
forDipToken
:
dip
Username
)
}
}
...
...
PIALibrary/Sources/VPN/PIATunnelProfile.swift
View file @
ee125793
...
...
@@ -249,8 +249,8 @@ public class PIATunnelProfile: NetworkExtensionProfile {
let
cfg
=
NETunnelProviderProtocol
()
cfg
.
disconnectOnSleep
=
configuration
.
disconnectsOnSleep
cfg
.
username
=
configuration
.
server
.
dipUsername
()
!=
nil
?
configuration
.
server
.
dipUsername
()
:
configuration
.
username
cfg
.
passwordReference
=
configuration
.
server
.
dipUsername
()
!=
nil
?
configuration
.
server
.
dipPassword
()
:
configuration
.
passwordReference
cfg
.
username
=
configuration
.
server
.
dipUsername
!=
nil
?
configuration
.
server
.
dipUsername
:
configuration
.
username
cfg
.
passwordReference
=
configuration
.
server
.
dipUsername
!=
nil
?
configuration
.
server
.
dipPassword
()
:
configuration
.
passwordReference
cfg
.
serverAddress
=
serverAddress
cfg
.
providerBundleIdentifier
=
bundleIdentifier
cfg
.
providerConfiguration
=
customCfg
?
.
serialized
()
...
...
PIALibrary/Sources/VPN/PIAWGTunnelProfile.swift
View file @
ee125793
...
...
@@ -250,7 +250,7 @@ public class PIAWGTunnelProfile: NetworkExtensionProfile {
cfg
.
username
=
Client
.
providers
.
accountProvider
.
publicUsername
cfg
.
disconnectOnSleep
=
configuration
.
disconnectsOnSleep
let
token
=
configuration
.
server
.
dipUsername
()
!=
nil
?
configuration
.
server
.
dipUsername
()
:
Client
.
providers
.
accountProvider
.
token
let
token
=
configuration
.
server
.
dipUsername
!=
nil
?
configuration
.
server
.
dipUsername
:
Client
.
providers
.
accountProvider
.
token
cfg
.
providerConfiguration
=
[
PIAWireguardConfiguration
.
Keys
.
token
:
token
,
PIAWireguardConfiguration
.
Keys
.
ping
:
configuration
.
server
.
bestAddress
()?
.
description
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment