Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update VPN user agent #971

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ let package = Package(
dependencies: [
.target(name: "WireGuardC"),
"Common",
"Networking"
],
swiftSettings: [
.define("DEBUG", .when(configuration: .debug))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
//

import Foundation
import Networking
import os.log

protocol NetworkProtectionClient {
func getLocations(authToken: String) async -> Result<[NetworkProtectionLocation], NetworkProtectionClientError>
Expand Down Expand Up @@ -244,6 +246,7 @@ final class NetworkProtectionBackendClient: NetworkProtectionClient {

func getLocations(authToken: String) async -> Result<[NetworkProtectionLocation], NetworkProtectionClientError> {
var request = URLRequest(url: locationsURL)
request.allHTTPHeaderFields = APIRequest.Headers().httpHeaders
request.setValue("bearer \(authToken)", forHTTPHeaderField: "Authorization")
let downloadedData: Data

Expand Down Expand Up @@ -287,6 +290,7 @@ final class NetworkProtectionBackendClient: NetworkProtectionClient {

func getServers(authToken: String) async -> Result<[NetworkProtectionServer], NetworkProtectionClientError> {
var request = URLRequest(url: serversURL)
request.allHTTPHeaderFields = APIRequest.Headers().httpHeaders
request.setValue("bearer \(authToken)", forHTTPHeaderField: "Authorization")
let downloadedData: Data

Expand Down Expand Up @@ -330,6 +334,7 @@ final class NetworkProtectionBackendClient: NetworkProtectionClient {

func getServerStatus(authToken: String, serverName: String) async -> Result<NetworkProtectionServerStatus, NetworkProtectionClientError> {
var request = URLRequest(url: serverStatusURL(serverName: serverName))
request.allHTTPHeaderFields = APIRequest.Headers().httpHeaders
request.setValue("bearer \(authToken)", forHTTPHeaderField: "Authorization")
let downloadedData: Data

Expand Down Expand Up @@ -382,6 +387,7 @@ final class NetworkProtectionBackendClient: NetworkProtectionClient {
}

var request = URLRequest(url: registerKeyURL)
request.allHTTPHeaderFields = APIRequest.Headers().httpHeaders
request.setValue("bearer \(authToken)", forHTTPHeaderField: "Authorization")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
Expand Down Expand Up @@ -444,6 +450,7 @@ final class NetworkProtectionBackendClient: NetworkProtectionClient {
}

var request = URLRequest(url: endpoint)
request.allHTTPHeaderFields = APIRequest.Headers().httpHeaders
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = requestBodyData
Expand Down
Loading