-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathagentkey_schema.ts
More file actions
1301 lines (1088 loc) · 31.6 KB
/
Copy pathagentkey_schema.ts
File metadata and controls
1301 lines (1088 loc) · 31.6 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* eslint-disable @typescript-eslint/no-explicit-any */
abstract class ApiBase {
abstract _call(path: string, request: any): Promise<any>;
async v1_tunnels_list(): Promise<ApiResultNoFail<AccountTunnelsV1>> {
return await this._call("/v1/tunnels/list", {}) as ApiResultNoFail<AccountTunnelsV1>;
}
async v1_tunnels_create(req: ReqTunnelsCreateV1): Promise<ApiResult<ObjectId, TunnelCreateErrorV1>> {
return await this._call("/v1/tunnels/create", req) as ApiResult<ObjectId, TunnelCreateErrorV1>;
}
async v1_schemas_get(req: ReqSchemasGetV1): Promise<ApiResult<SchemaData, SchemaGetError>> {
return await this._call("/v1/schemas/get", req) as ApiResult<SchemaData, SchemaGetError>;
}
async v1_tunnels_config(req: ReqTunnelsConfigV1): Promise<ApiResult<undefined, TunnelConfigError>> {
return await this._call("/v1/tunnels/config", req) as ApiResult<undefined, TunnelConfigError>;
}
async v1_tunnels_propset(req: ReqTunnelsPropset): Promise<ApiResult<undefined, TunnelPropSetError>> {
return await this._call("/v1/tunnels/propset", req) as ApiResult<undefined, TunnelPropSetError>;
}
async v1_tunnels_typeset(req: ReqTunnelsTypeset): Promise<ApiResult<undefined, TunnelTypeSetError>> {
return await this._call("/v1/tunnels/typeset", req) as ApiResult<undefined, TunnelTypeSetError>;
}
async v1_agents_rundata(): Promise<ApiResultNoFail<AgentRunDataV1>> {
return await this._call("/v1/agents/rundata", {}) as ApiResultNoFail<AgentRunDataV1>;
}
async info_pops(): Promise<ApiResultNoFail<PlayitPops>> {
return await this._call("/info/pops", {}) as ApiResultNoFail<PlayitPops>;
}
async login_signin(req: ReqLoginSignin): Promise<ApiResult<WebSession, SigninFail>> {
return await this._call("/login/signin", req) as ApiResult<WebSession, SigninFail>;
}
async login_clearcookie(): Promise<ApiResultNoFail<ClearWebSession>> {
return await this._call("/login/clearcookie", {}) as ApiResultNoFail<ClearWebSession>;
}
async login_create_guest(): Promise<ApiResult<WebSession, LoginCreateGuestError>> {
return await this._call("/login/create/guest", {}) as ApiResult<WebSession, LoginCreateGuestError>;
}
async login_guest(): Promise<ApiResult<WebSession, GuestLoginError>> {
return await this._call("/login/guest", {}) as ApiResult<WebSession, GuestLoginError>;
}
async login_reset_password(req: ReqLoginResetPassword): Promise<ApiResult<WebSession, PasswordResetError>> {
return await this._call("/login/reset/password", req) as ApiResult<WebSession, PasswordResetError>;
}
async login_reset_send(req: ReqLoginResetSend): Promise<ApiResultNoFail<undefined>> {
return await this._call("/login/reset/send", req) as ApiResultNoFail<undefined>;
}
async tunnels_create(req: ReqTunnelsCreate): Promise<ApiResult<ObjectId, TunnelCreateError>> {
return await this._call("/tunnels/create", req) as ApiResult<ObjectId, TunnelCreateError>;
}
async tunnels_list(req: ReqTunnelsList): Promise<ApiResultNoFail<AccountTunnels>> {
return await this._call("/tunnels/list", req) as ApiResultNoFail<AccountTunnels>;
}
async tunnels_update(req: ReqTunnelsUpdate): Promise<ApiResult<undefined, UpdateError>> {
return await this._call("/tunnels/update", req) as ApiResult<undefined, UpdateError>;
}
async tunnels_delete(req: ReqTunnelsDelete): Promise<ApiResult<undefined, DeleteError>> {
return await this._call("/tunnels/delete", req) as ApiResult<undefined, DeleteError>;
}
async tunnels_rename(req: ReqTunnelsRename): Promise<ApiResult<undefined, TunnelRenameError>> {
return await this._call("/tunnels/rename", req) as ApiResult<undefined, TunnelRenameError>;
}
async tunnels_firewall_assign(req: ReqTunnelsFirewallAssign): Promise<ApiResult<undefined, TunnelsFirewallAssignError>> {
return await this._call("/tunnels/firewall/assign", req) as ApiResult<undefined, TunnelsFirewallAssignError>;
}
async tunnels_ratelimit(req: ReqTunnelsRatelimit): Promise<ApiResult<undefined, TunnelRatelimitError>> {
return await this._call("/tunnels/ratelimit", req) as ApiResult<undefined, TunnelRatelimitError>;
}
async tunnels_enable(req: ReqTunnelsEnable): Promise<ApiResult<undefined, TunnelEnableError>> {
return await this._call("/tunnels/enable", req) as ApiResult<undefined, TunnelEnableError>;
}
async tunnels_proxy_set(req: ReqTunnelsProxySet): Promise<ApiResult<undefined, TunnelProxySetError>> {
return await this._call("/tunnels/proxy/set", req) as ApiResult<undefined, TunnelProxySetError>;
}
async claim_setup(req: ReqClaimSetup): Promise<ApiResult<ClaimSetupResponse, ClaimSetupError>> {
return await this._call("/claim/setup", req) as ApiResult<ClaimSetupResponse, ClaimSetupError>;
}
async claim_exchange(req: ReqClaimExchange): Promise<ApiResult<AgentSecretKey, ClaimExchangeError>> {
return await this._call("/claim/exchange", req) as ApiResult<AgentSecretKey, ClaimExchangeError>;
}
async agents_rename(req: ReqAgentsRename): Promise<ApiResult<undefined, AgentRenameError>> {
return await this._call("/agents/rename", req) as ApiResult<undefined, AgentRenameError>;
}
async agents_routing_set(req: ReqAgentsRoutingSet): Promise<ApiResult<undefined, AgentRoutingSetError>> {
return await this._call("/agents/routing/set", req) as ApiResult<undefined, AgentRoutingSetError>;
}
async agents_routing_get(req: ReqAgentsRoutingGet): Promise<ApiResult<AgentRouting, AgentRoutingGetError>> {
return await this._call("/agents/routing/get", req) as ApiResult<AgentRouting, AgentRoutingGetError>;
}
async agents_rundata(): Promise<ApiResultNoFail<AgentRunData>> {
return await this._call("/agents/rundata", {}) as ApiResultNoFail<AgentRunData>;
}
async domains_list(): Promise<ApiResultNoFail<Domains>> {
return await this._call("/domains/list", {}) as ApiResultNoFail<Domains>;
}
async shop_prices(): Promise<ApiResultNoFail<ShopPrices>> {
return await this._call("/shop/prices", {}) as ApiResultNoFail<ShopPrices>;
}
async shop_availability_custom_domain(req: ReqShopAvailabilityCustomDomain): Promise<ApiResultNoFail<IsAvailable>> {
return await this._call("/shop/availability/custom_domain", req) as ApiResultNoFail<IsAvailable>;
}
async proto_register(req: ReqProtoRegister): Promise<ApiResult<SignedAgentKey, ProtoRegisterError>> {
return await this._call("/proto/register", req) as ApiResult<SignedAgentKey, ProtoRegisterError>;
}
async charge_get(req: ReqChargeGet): Promise<ApiResult<ChargeDetails, ChargeGetError>> {
return await this._call("/charge/get", req) as ApiResult<ChargeDetails, ChargeGetError>;
}
async charge_refund(req: ReqChargeRefund): Promise<ApiResult<undefined, ChargeRefundError>> {
return await this._call("/charge/refund", req) as ApiResult<undefined, ChargeRefundError>;
}
async query_region(req: ReqQueryRegion): Promise<ApiResult<QueryRegion, QueryRegionError>> {
return await this._call("/query/region", req) as ApiResult<QueryRegion, QueryRegionError>;
}
}
export default ApiBase;
export type ApiResponseError = { type: "validation", message: string }
| { type: "path-not-found", message: PathNotFound }
| { type: "auth", message: AuthError }
| { type: "internal", message: ApiInternalError };
export type String = string;
export type PathNotFound = {
path: String;
};
export type AuthError = "AuthRequired"
| "InvalidHeader"
| "InvalidSignature"
| "InvalidTimestamp"
| "InvalidApiKey"
| "InvalidAgentKey"
| "SessionExpired"
| "InvalidAuthType"
| "ScopeNotAllowed"
| "NoLongerValid"
| "GuestAccountNotAllowed"
| "EmailMustBeVerified"
| "AccountDoesNotExist"
| "AdminOnly"
| "InvalidToken"
| "TotpRequred"
| "NotAllowedWithReadOnly"
| "DefaultAgentBlocked"
| "AgentNotSelfManaged"
| "SelfManagedAgentCanOnlyAffectSelf"
| "AccountNotAuthorized";
export type ApiInternalError = {
trace_id: String;
};
export type ApiResult<S, F> = { status: "success", data: S } | { status: "fail", data: F } | { status: "error", data: ApiResponseError };
export type ApiResultNoFail<S> = { status: "success", data: S } | { status: "error", data: ApiResponseError };
export type Option<T> = T | null;
export type Arc<T> = T;
export type Box<T> = T;
export type Vec<T> = T[];
export type ReqTunnelsListV1 = object;
export type AccountTunnelsV1 = {
tunnels: Vec<AccountTunnelV1>;
};
export type AccountTunnelV1 = {
id: Uuid;
created_at: DateTimeUtc;
name: Option<String>;
user_enabled: bool;
offline_reasons: Option<Vec<AccountTunnelOfflineReason>>;
tunnel_type: Option<TunnelType>;
port_type: PortType;
port_count: u16;
firewall_id: Option<Uuid>;
props: AccountTunnelProps;
origin: AccountTunnelOrigin;
port_allocation_requests: Vec<PortAllocationRequest>;
public_allocations: Vec<PublicAllocation>;
connect_addresses: Vec<ConnectAddress>;
};
export type Uuid = string;
export type DateTimeUtc = string;
export type bool = boolean;
export type AccountTunnelOfflineReason = "OriginNotSet"
| "AgentDisabled"
| "AgentOverLimit"
| "TunnelDisabled"
| "PublicAllocationMissing"
| "PublicAllocationPending";
export type TunnelType = "minecraft-java"
| "minecraft-bedrock"
| "valheim"
| "terraria"
| "starbound"
| "rust"
| "7days"
| "unturned"
| "https"
| "hytale"
| "project-zomboid"
| "vintage-story";
export type PortType = "tcp"
| "udp"
| "both";
export type u16 = number;
export type AccountTunnelProps = {
hostname_verify_level: HostnameVerifyLevel;
};
export type HostnameVerifyLevel = "None"
| "NoRawIp"
| "NoAutoName";
export type AccountTunnelOrigin = { type: "not-set", details: TunnelOriginNotSet }
| { type: "agent", details: TunnelToAgent };
export type TunnelOriginNotSet = {
agent_config: Option<HasAgentConfig>;
};
export type HasAgentConfig = {
config_schema_id: Uuid;
config_data: AgentTunnelConfig;
};
export type AgentTunnelConfig = {
fields?: Vec<AgentTunnelAttr>;
};
export type AgentTunnelAttr = {
name: String;
value: String;
};
export type TunnelToAgent = {
agent_id: Uuid;
name: String;
config_schema_id: Uuid;
config_data: AgentTunnelConfig;
config_invalid: Option<InvalidTunnelConfig>;
};
export type InvalidTunnelConfig = {
agent_schema_id: Uuid;
current_schema: AgentTunnelSchema;
target_schema: Option<AgentTunnelSchema>;
};
export type AgentTunnelSchema = {
fields: { [key in String]: AgentTunnelSchemaField };
};
export type AgentTunnelSchemaField = {
label?: Option<String>;
description?: Option<String>;
value_type: AgentTunnelAttrType;
allow_null: bool;
default_value?: Option<String>;
variants?: Option<Vec<String>>;
};
export type AgentTunnelAttrType = "Ip"
| "Ip4"
| "Ip6"
| "SockAddr"
| "SockAddr4"
| "SockAddr6"
| "Port"
| "U64"
| "I64"
| "Boolean"
| "String";
export type PortAllocationRequest = {
id: Uuid;
status: PortAllocationStatus;
region: PlayitNetwork;
public_port?: Option<u16>;
public_ip?: Option<IpAddr>;
};
export type PortAllocationStatus = "Pending"
| "RanOutOfPorts"
| "PublicPortNotAvailable"
| "NoPortsAvailableOnIp"
| "AccountPortLimitReached"
| string;
export type PlayitNetwork = "global"
| "north-america"
| "europe"
| "asia"
| "india"
| "south-america"
| "chile"
| "seattle-washington"
| "los-angeles-california"
| "denver-colorado"
| "dallas-texas"
| "chicago-illinois"
| "new-york"
| "_NaReserved1"
| "_NaReserved2"
| "united-kingdom"
| "germany"
| "sweden"
| "poland"
| "romania"
| "_Test"
| "japan"
| "australia";
export type IpAddr = string;
export type PublicAllocation = { type: "PortAllocation", details: PortAllocation }
| { type: "Gateway", details: GatewayAllocation };
export type PortAllocation = {
alloc_id: Uuid;
ip_region: PlayitNetwork;
ip_hostname: String;
auto_domain: String;
ip: IpAddr;
port: u16;
port_count: u16;
port_type: PortType;
expire_notice: Option<ExpireNotice>;
};
export type ExpireNotice = {
disable_at: DateTimeUtc;
remove_at: DateTimeUtc;
reason: DisabledReason;
};
export type DisabledReason = "requires-premium"
| "over-port-limit";
export type GatewayAllocation = {
id: Option<Uuid>;
hostname: String;
region: PlayitNetwork;
};
export type ConnectAddress = { type: "addr4", value: ConnectAddr4 }
| { type: "addr6", value: ConnectAddr6 }
| { type: "ip4", value: ConnectIp4 }
| { type: "ip6", value: ConnectIp6 }
| { type: "auto", value: ConnectAutoName }
| { type: "domain", value: ConnectDomain };
export type ConnectAddr4 = {
address: SocketAddrV4;
source: ConnectAddressSource;
};
export type SocketAddrV4 = string;
export type ConnectAddressSource = { resource: "port-allocation", id: Uuid }
| { resource: "gateway", id: Uuid };
export type ConnectAddr6 = {
address: SocketAddrV6;
source: ConnectAddressSource;
};
export type SocketAddrV6 = string;
export type ConnectIp4 = {
address: Ipv4Addr;
default_port: u16;
source: ConnectAddressSource;
};
export type Ipv4Addr = string;
export type ConnectIp6 = {
address: Ipv6Addr;
default_port: u16;
source: ConnectAddressSource;
};
export type Ipv6Addr = string;
export type ConnectAutoName = {
address: String;
source: ConnectAddressSource;
};
export type ConnectDomain = {
id: Uuid;
domain: String;
address: String;
mode: DomainMode;
source: ConnectAddressSource;
};
export type DomainMode = "Ip"
| "Srv"
| "SrvAndIp"
| "Hostname";
export type Undefined = undefined;
export type ReqTunnelsCreateV1 = {
name: String;
protocol: TunnelProtocol;
origin: AccountTunnelOriginCreate;
endpoint: CreateTunnelEndpoint;
enabled?: bool;
firewall_id?: Option<Uuid>;
};
export type TunnelProtocol = { type: "tunnel-type", details: TunnelType }
| { type: "raw-ports", details: TunnelProtocolRawPorts };
export type TunnelProtocolRawPorts = {
port_type: PortType;
port_count: u16;
software_description: String;
};
export type AccountTunnelOriginCreate = { type: "agent", data: AgentOrigin };
export type AgentOrigin = {
agent_id: Option<Uuid>;
config?: AgentTunnelConfig;
};
export type CreateTunnelEndpoint = { type: "gateway", details: UseGateway }
| { type: "dedicated-ip", details: UseAllocDedicatedIp }
| { type: "shared-ip", details: UseAllocSharedIp }
| { type: "region", details: UseAllocRegion }
| { type: "port-allocation", details: Uuid };
export type UseGateway = {
gateway_id: Uuid;
};
export type UseAllocDedicatedIp = {
ip_hostname: String;
port: Option<u16>;
};
export type UseAllocSharedIp = {
ip_hostname: String;
port: Option<u16>;
};
export type UseAllocRegion = {
region: PlayitNetwork;
port: Option<u16>;
};
export type ObjectId = {
id: Uuid;
};
export type TunnelCreateErrorV1 = "AgentNotFound"
| "InvalidAgentId"
| "DedicatedIpNotFound"
| "PortAllocNotFound"
| "InvalidIpHostname"
| "InvalidPortCount"
| "RequiresVerifiedAccount"
| "RegionNotSupported"
| "InvalidTunnelConfig"
| "FirewallNotFound"
| "TunnelNameIsNotAscii"
| "TunnelNameTooLong"
| "PortAllocDoesNotMatchPortDetails"
| "RegionRequiresPlayitPremium"
| "PortAllocCurrentlyAssigned"
| "PublicPortRequiresPlayitPremium"
| "AgentVersionTooOld"
| "RequiresPlayitPremium"
| "EndpointDoesNotSupportProtocol"
| "InvalidGatewayId"
| "GatewayAlreadyHasTunnelType"
| "GatewayDoesNotSupportTunnelType"
| "TunnelTypeBlockedOnRegion"
| "InvalidSoftwareDescription";
export type ReqSchemasGetV1 = {
id: Uuid;
};
export type SchemaData = {
id: Uuid;
details: AgentSchema;
};
export type AgentSchema = {
default_schema?: Option<AgentTunnelSchema>;
schemas?: Vec<AgentSchemaForTunnelType>;
only_explicit_schemas?: bool;
};
export type AgentSchemaForTunnelType = {
tunnel_type: AgentSchemaTunnelType;
schema?: Option<AgentTunnelSchema>;
};
export type AgentSchemaTunnelType = { name: "custom-tcp", details: AgentTunnelTypeSupportedPorts }
| { name: "custom-udp", details: AgentTunnelTypeSupportedPorts }
| { name: "custom-both", details: AgentTunnelTypeSupportedPorts }
| { name: "tunnel-type", details: TunnelType };
export type AgentTunnelTypeSupportedPorts = {
min: u16;
max: u16;
};
export type SchemaGetError = "SchemaNotFound";
export type ReqTunnelsConfigV1 = {
tunnel_id: Uuid;
new_agent_id: Option<Uuid>;
new_config: Option<AgentTunnelConfig>;
};
export type TunnelConfigError = { error: "TunnelNotFound", details: null }
| { error: "AgentNotFound", details: null }
| { error: "AgentVersionUnknown", details: null }
| { error: "CannotConfigTunnelWithoutAgent", details: null }
| { error: "SelfManagedAgentCannotReassignTunnel", details: null }
| { error: "InvalidConfig", details: AgentSchemaValidationError }
| { error: "ConfigNotCompatibleWithAgent", details: null }
| { error: "NothingToUpdate", details: null };
export type AgentSchemaValidationError = { error: "NoSchemaFound", field: null }
| { error: "TooManyFields", field: null }
| { error: "TunnelTypeNotSupported", field: TunnelEndpointPortRequirements }
| { error: "UnknownField", field: String }
| { error: "MissingRequiredField", field: String }
| { error: "InvalidValueForType", field: String }
| { error: "ValueNotInVariants", field: String };
export type TunnelEndpointPortRequirements = {
tunnel_type: Option<TunnelType>;
port_type: PortType;
port_count: u16;
};
export type ReqTunnelsPropset = {
tunnel_id: Uuid;
details: PropsetDetails;
};
export type PropsetDetails = { type: "hostname_verify_level", value: HostnameVerifyLevel }
| { type: "custom_tunnel_details", value: String };
export type TunnelPropSetError = "RequiresPermium"
| "TunnelNotFound"
| "PropertyValueNotSupportedForTunnelType"
| "PropertyValueInvalid";
export type ReqTunnelsTypeset = {
tunnel_id: Uuid;
tunnel_type: TunnelType;
};
export type TunnelTypeSetError = "RequiresPermium"
| "TunnelNotFound"
| "TunnelHasInvalidSettingsForType"
| "CannotChangeTunnelType";
export type ReqAgentsRundataV1 = object;
export type AgentRunDataV1 = {
agent_id: Uuid;
tunnels: Vec<AgentTunnelV1>;
pending: Vec<AgentPendingTunnelV1>;
notices: Vec<AgentNotice>;
permissions: AgentPermissions;
};
export type AgentTunnelV1 = {
id: Uuid;
internal_id: u64;
name: String;
display_address: String;
port_type: PortType;
port_count: u16;
tunnel_type: Option<String>;
tunnel_type_display: String;
agent_config: AgentTunnelConfig;
disabled_reason: Option<Cow<'static,str>>;
};
export type u64 = number;
export type AgentPendingTunnelV1 = {
id: Uuid;
name: String;
tunnel_type: Option<String>;
tunnel_type_display: String;
port_type: PortType;
port_count: u16;
status_msg: String;
};
export type AgentNotice = {
priority: AgentNoticePriority;
message: Cow<'static,str>;
resolve_link: Option<String>;
};
export type AgentNoticePriority = "Critical"
| "High"
| "Low";
export type AgentPermissions = {
is_self_managed: bool;
has_premium: bool;
account_status: AccountStatus;
};
export type AccountStatus = "guest"
| "email-not-verified"
| "verified";
export type ReqInfoPops = object;
export type PlayitPops = {
pops: Vec<Pop>;
regions: Vec<PlayitNetwork>;
};
export type Pop = {
pop: PlayitPop;
name: String;
region: PlayitNetwork;
online: bool;
ip4_premium: bool;
};
export type PlayitPop = "Any"
| "USLosAngeles"
| "USSeattle"
| "USDallas"
| "USMiami"
| "USChicago"
| "USNewJersey"
| "CanadaToronto"
| "Mexico"
| "BrazilSaoPaulo"
| "Spain"
| "London"
| "Germany"
| "Poland"
| "Sweden"
| "IndiaDelhi"
| "IndiaMumbai"
| "IndiaBangalore"
| "Singapore"
| "Tokyo"
| "Sydney"
| "SantiagoChile"
| "Israel"
| "Romania"
| "USNewYork"
| "USDenver"
| "Staging";
export type ReqLoginSignin = LoginCredentials;
export type LoginCredentials = {
email: String;
password: String;
};
export type WebSession = {
session_key: String;
auth: WebAuthToken;
};
export type WebAuthToken = {
update_version: u32;
account_id: u64;
timestamp: u64;
account_status: AccountStatus;
totp_status: TotpStatus;
admin_id: Option<u64>;
admin_review_id: Option<u64>;
read_only: bool;
show_admin: bool;
};
export type u32 = number;
export type TotpStatus = { status: "required" }
| { status: "not-setup" }
| { status: "signed" } & SignedEpoch;
export type SignedEpoch = {
epoch_sec: u32;
};
export type SigninFail = "IncorrectCredentials"
| "AccountBanned";
export type ReqLoginClearcookie = object;
export type ClearWebSession = object;
export type ReqLoginCreateGuest = object;
export type LoginCreateGuestError = "Blocked";
export type ReqLoginGuest = object;
export type GuestLoginError = "AccountIsNotGuest";
export type ReqLoginResetPassword = {
email: String;
reset_code: String;
new_password: String;
};
export type PasswordResetError = "ResetCodeExpired"
| "InvalidResetCode"
| "InvalidNewPassword";
export type ReqLoginResetSend = {
email: String;
};
export type ReqTunnelsCreate = {
name: Option<String>;
tunnel_type: Option<TunnelType>;
tunnel_description: Option<String>;
port_type: PortType;
port_count: u16;
origin: TunnelOriginCreate;
enabled: bool;
alloc: Option<TunnelCreateUseAllocation>;
firewall_id: Option<Uuid>;
proxy_protocol: Option<ProxyProtocol>;
};
export type TunnelOriginCreate = { type: "default", data: AssignedDefaultCreate }
| { type: "agent", data: AssignedAgentCreate }
| { type: "managed", data: AssignedManagedCreate };
export type AssignedDefaultCreate = {
local_ip: IpAddr;
local_port: Option<u16>;
};
export type AssignedAgentCreate = {
agent_id: Uuid;
local_ip: IpAddr;
local_port: Option<u16>;
};
export type AssignedManagedCreate = {
agent_id: Option<Uuid>;
};
export type TunnelCreateUseAllocation = { type: "dedicated-ip", details: UseAllocDedicatedIp }
| { type: "port-allocation", details: UseAllocPortAlloc }
| { type: "region", details: UseRegion };
export type UseAllocPortAlloc = {
alloc_id: Uuid;
};
export type UseRegion = {
region: PlayitNetwork;
};
export type ProxyProtocol = "proxy-protocol-v1"
| "proxy-protocol-v2";
export type TunnelCreateError = "DefaultAgentNotSupported"
| "AgentNotFound"
| "InvalidAgentId"
| "AgentVersionTooOld"
| "DedicatedIpNotFound"
| "DedicatedIpPortNotAvailable"
| "DedicatedIpNotEnoughSpace"
| "PortAllocNotFound"
| "InvalidIpHostname"
| "ManagedMissingAgentId"
| "InvalidPortCount"
| "RequiresVerifiedAccount"
| "InvalidTunnelName"
| "FirewallNotFound"
| "AllocInvalid"
| "InvalidOrigin"
| "RequiresPlayitPremium"
| "TunnelTypeBlockedOnRegion"
| "TunnelTypeRequiresDescription"
| "Other";
export type ReqTunnelsList = {
tunnel_id: Option<Uuid>;
agent_id: Option<Uuid>;
};
export type AccountTunnels = {
tunnels: Vec<AccountTunnel>;
tcp_alloc: AllocatedPorts;
udp_alloc: AllocatedPorts;
};
export type AccountTunnel = {
id: Uuid;
tunnel_type: Option<TunnelType>;
created_at: DateTimeUtc;
name: Option<String>;
port_type: PortType;
port_count: u16;
alloc: AccountTunnelAllocation;
origin: Option<TunnelOrigin>;
domain: Option<TunnelDomain>;
firewall_id: Option<Uuid>;
ratelimit: Ratelimit;
active: bool;
disabled_reason: Option<TunnelOfflineReason>;
region: Option<PlayitNetwork>;
expire_notice: Option<ExpireNotice>;
proxy_protocol: Option<ProxyProtocol>;
hostname_verify_level: HostnameVerifyLevel;
agent_over_limit: bool;
};
export type AccountTunnelAllocation = { status: "pending", data: null }
| { status: "disabled", data: TunnelDisabled }
| { status: "allocated", data: TunnelAllocated };
export type TunnelDisabled = {
reason: TunnelOfflineReason;
};
export type TunnelOfflineReason = "requires-premium"
| "over-port-limit"
| "ip-used-in-gre"
| "public-port-not-available";
export type TunnelAllocated = {
id: Uuid;
ip_hostname: String;
static_ip4: Option<Ipv4Addr>;
static_ip6: Ipv6Addr;
assigned_domain: String;
assigned_srv: Option<String>;
tunnel_ip: IpAddr;
port_start: u16;
port_end: u16;
assignment: TunnelAssignment;
ip_type: IpType;
region: PlayitNetwork;
};
export type TunnelAssignment = { type: "dedicated-ip", subscription: TunnelDedicatedIp }
| { type: "shared-ip", subscription: null }
| { type: "dedicated-port", subscription: SubscriptionId };
export type TunnelDedicatedIp = {
sub_id: Uuid;
region: PlayitNetwork;
};
export type SubscriptionId = {
sub_id: Uuid;
};
export type IpType = "both"
| "ip4"
| "ip6";
export type TunnelOrigin = { type: "agent", data: AssignedAgent }
| { type: "managed", data: AssignedManaged };
export type AssignedAgent = {
agent_id: Uuid;
agent_name: String;
local_ip: IpAddr;
local_port: Option<u16>;
};
export type AssignedManaged = {
agent_id: Uuid;
agent_name: String;
};
export type TunnelDomain = {
id: Uuid;
name: String;
};
export type Ratelimit = {
bytes_per_second: Option<u32>;
packets_per_second: Option<u32>;
};
export type AllocatedPorts = {
allowed: u32;
claimed: u32;
desired: u32;
};
export type ReqTunnelsUpdate = {
tunnel_id: Uuid;
local_ip: IpAddr;
local_port: Option<u16>;
agent_id: Option<Uuid>;
enabled: bool;
};
export type UpdateError = "ChangingAgentIdNotAllowed"
| "TunnelNotFound"
| "CannotUpdateLocalAddressForUnassignedTunnel"
| "InvalidAgentId"
| "AddressOrProxyProtoNotSupportedByAgent";
export type ReqTunnelsDelete = {
tunnel_id: Uuid;
};
export type DeleteError = "TunnelNotFound";
export type ReqTunnelsRename = {
tunnel_id: Uuid;
name: String;
};
export type TunnelRenameError = "TunnelNotFound"
| "NameTooLong";
export type ReqTunnelsFirewallAssign = {
tunnel_id: Uuid;
firewall_id: Option<Uuid>;
};
export type TunnelsFirewallAssignError = "TunnelNotFound"
| "InvalidFirewallId";
export type ReqTunnelsRatelimit = {
tunnel_id: Uuid;
bytes_per_second: Option<u32>;
packets_per_second: Option<u32>;
};
export type TunnelRatelimitError = "TunnelNotFound"
| "InvalidRatelimit"
| "PlayitPremiumRequired";
export type ReqTunnelsEnable = {
tunnel_id: Uuid;
enabled: bool;
};
export type TunnelEnableError = "TunnelNotFound";
export type ReqTunnelsProxySet = {
tunnel_id: Uuid;
proxy_protocol: Option<ProxyProtocol>;
};
export type TunnelProxySetError = "TunnelNotFound"
| "ProxyProtocolNotSupportedByAgent";
export type ReqClaimSetup = {
code: String;
agent_type: ClaimAgentType;
version: String;
};
export type ClaimAgentType = "assignable"
| "self-managed";
export type ClaimSetupResponse = "WaitingForUserVisit"
| "WaitingForUser"
| "UserAccepted"
| "UserRejected";
export type ClaimSetupError = "InvalidCode"
| "CodeExpired"
| "VersionTextTooLong";
export type ReqClaimExchange = {
code: String;
};
export type AgentSecretKey = {
secret_key: String;
};
export type ClaimExchangeError = "CodeNotFound"