blob: 0ad4d23bbdaa721ccbeef22a082a4a317ca929b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
//
// Socks5ConnectCommand.swift
// MullvadTransport
//
// Created by pronebird on 19/10/2023.
//
import Foundation
import Network
/// The connect command message.
struct Socks5ConnectCommand {
/// The remote endpoint to which the client wants to establish connection over the socks proxy.
var endpoint: Socks5Endpoint
/// The byte representation in socks protocol.
var rawData: Data {
var data = Data()
// Socks version.
data.append(Socks5Constants.socksVersion)
// Command code.
data.append(Socks5Command.connect.rawValue)
// Reserved.
data.append(0)
// Address type.
data.append(endpoint.addressType.rawValue)
// Endpoint address.
data.append(endpoint.rawData)
return data
}
}
/// The connect command reply message.
struct Socks5ConnectReply {
/// The server status code.
var status: Socks5StatusCode
/// The server bound endpoint.
var serverBoundEndpoint: Socks5Endpoint
}
|