| todayTrafficOut: number |
| 9 | curConns: number |
| 10 | lastStartTime: string |
| 11 | lastCloseTime: string |
| 12 | status: string |
| 13 | } |
| 14 |
| 15 | export interface GetProxyResponse { |
| 16 | proxies: ProxyStatsInfo[] |
| 17 | } |
| 18 |
| 19 | export interface ProxyListV2Params { |
| 20 | page?: number |
| 21 | pageSize?: number |
| 22 | status?: 'all' | 'online' | 'offline' |
| 23 | q?: string |
| 24 | type?: string |
| 25 | user?: string |
| 26 | clientID?: string |
| 27 | } |
| 28 |
| 29 | export interface ProxyV2Info { |
| 30 | name: string |
| 31 | user: string |
| 32 | clientID: string |
| 33 | spec: ProxyV2Spec |
| 34 | status: ProxyV2Status |
| 35 | } |
| 36 |
| 37 | export interface ProxyV2BaseSpec { |
| 38 | annotations?: Record<string, string> |
| 39 | metadatas?: Record<string, string> |
| 40 | transport?: { |
| 41 | useEncryption: boolean |
| 42 | useCompression: boolean |
| 43 | bandwidthLimit: string |
| 44 | bandwidthLimitMode: string |
| 45 | } |
| 46 | loadBalancer?: { |
| 47 | group: string |
| 48 | } |
| 49 | } |
| 50 |
| 51 | export interface ProxyV2TCPBlock extends ProxyV2BaseSpec { |
| 52 | remotePort?: number |
| 53 | } |
| 54 |
| 55 | export interface ProxyV2UDPBlock extends ProxyV2BaseSpec { |
| 56 | remotePort?: number |
| 57 | } |
| 58 |
| 59 | export interface ProxyV2HTTPBlock extends ProxyV2BaseSpec { |
| 60 | customDomains?: string[] |
| 61 | subdomain?: string |
| 62 | locations?: string[] |
| 63 | hostHeaderRewrite?: string |
| 64 | } |
| 65 |
| 66 | export interface ProxyV2HTTPSBlock extends ProxyV2BaseSpec { |
| 67 | customDomains?: string[] |
| 68 | subdomain?: string |
| 69 | } |
| 70 |
| 71 | export interface ProxyV2TCPMuxBlock extends ProxyV2BaseSpec { |
| 72 | customDomains?: string[] |
| 73 | subdomain?: string |
| 74 | multiplexer?: string |
| 75 | routeByHTTPUser?: string |
| 76 | } |
| 77 |
| 78 | export type ProxyV2STCPBlock = ProxyV2BaseSpec |
| 79 |
| 80 | export type ProxyV2SUDPBlock = ProxyV2BaseSpec |
| 81 |
| 82 | export type ProxyV2XTCPBlock = ProxyV2BaseSpec |
| 83 |
| 84 | export interface ProxyV2SpecBlocks { |
| 85 | tcp: ProxyV2TCPBlock |
| 86 | udp: ProxyV2UDPBlock |
| 87 | http: ProxyV2HTTPBlock |
| 88 | https: ProxyV2HTTPSBlock |
| 89 | tcpmux: ProxyV2TCPMuxBlock |
| 90 | stcp: ProxyV2STCPBlock |
| 91 | sudp: ProxyV2SUDPBlock |
| 92 | xtcp: ProxyV2XTCPBlock |
| 93 | } |
| 94 |
| 95 | export type ProxyV2Type = keyof ProxyV2SpecBlocks |
| 96 |
| 97 | type ProxyV2SpecFor<T extends ProxyV2Type> = { |
| 98 | type: T |
| 99 | } & { |
| 100 | [K in T]: ProxyV2SpecBlocks[K] |
| 101 | } & { |
| 102 | [K in Exclude<ProxyV2Type, T>]?: never |
| 103 | } |
| 104 |
| 105 | export type ProxyV2Spec = { |
| 106 | [T in ProxyV2Type]: ProxyV2SpecFor<T> |
| 107 | }[ProxyV2Type] |
| 108 |
| 109 | export interface ProxyV2Status { |
| 110 | phase: 'online' | 'offline' |
| 111 | todayTrafficIn: number |
| 112 | todayTrafficOut: number |
| 113 | curConns: number |
| 114 | lastStartAt?: number |
| 115 | lastCloseAt?: number |
| 116 | } |
| 117 |
| 118 | export interface TrafficResponse { |
| 119 | name: string |
| 120 | unit: 'bytes' |
| 121 | granularity: 'day' |
| 122 | history: TrafficPoint[] |
| 123 | } |
| 124 |
| 125 | export interface TrafficPoint { |
| 126 | date: string |
| 127 | trafficIn: number |
| 128 | trafficOut: number |
| 129 | } |