blob: 241727b2cd4890f0cd8588cf6ede9ab55351821c (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
export namespace models {
export class Transport {
type?: string;
path?: string;
static createFrom(source: any = {}) {
return new Transport(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.type = source["type"];
this.path = source["path"];
}
}
export class TLS {
enabled: boolean;
server_name?: string;
static createFrom(source: any = {}) {
return new TLS(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.enabled = source["enabled"];
this.server_name = source["server_name"];
}
}
export class Server {
tag: string;
region: string;
type: string;
server: string;
server_port: number;
udp_over_tcp?: boolean;
uuid?: string;
method?: string;
password?: string;
tls?: TLS;
transport?: Transport;
static createFrom(source: any = {}) {
return new Server(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.tag = source["tag"];
this.region = source["region"];
this.type = source["type"];
this.server = source["server"];
this.server_port = source["server_port"];
this.udp_over_tcp = source["udp_over_tcp"];
this.uuid = source["uuid"];
this.method = source["method"];
this.password = source["password"];
this.tls = this.convertValues(source["tls"], TLS);
this.transport = this.convertValues(source["transport"], Transport);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}
export namespace sync {
export class LatencyResult {
tag: string;
region: string;
latency_ms: number;
static createFrom(source: any = {}) {
return new LatencyResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.tag = source["tag"];
this.region = source["region"];
this.latency_ms = source["latency_ms"];
}
}
export class UpdateInfo {
available: boolean;
version: string;
changelog: string;
current_version: string;
static createFrom(source: any = {}) {
return new UpdateInfo(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.available = source["available"];
this.version = source["version"];
this.changelog = source["changelog"];
this.current_version = source["current_version"];
}
}
}
|