| // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 |
| 15 | package model |
| 16 |
| 17 | type V2PageResp[T any] struct { |
| 18 | Total int `json:"total"` |
| 19 | Page int `json:"page"` |
| 20 | PageSize int `json:"pageSize"` |
| 21 | Items []T `json:"items"` |
| 22 | } |
| 23 |
| 24 | type V2SystemInfoResp struct { |
| 25 | Version string `json:"version"` |
| 26 | Config V2SystemInfoConfigResp `json:"config"` |
| 27 | Status V2SystemInfoStatusResp `json:"status"` |
| 28 | } |
| 29 |
| 30 | type V2SystemInfoConfigResp struct { |
| 31 | BindPort int `json:"bindPort"` |
| 32 | VhostHTTPPort int `json:"vhostHTTPPort"` |
| 33 | VhostHTTPSPort int `json:"vhostHTTPSPort"` |
| 34 | TCPMuxHTTPConnectPort int `json:"tcpmuxHTTPConnectPort"` |
| 35 | KCPBindPort int `json:"kcpBindPort"` |
| 36 | QUICBindPort int `json:"quicBindPort"` |
| 37 | SubdomainHost string `json:"subdomainHost"` |
| 38 | MaxPoolCount int64 `json:"maxPoolCount"` |
| 39 | MaxPortsPerClient int64 `json:"maxPortsPerClient"` |
| 40 | HeartbeatTimeout int64 `json:"heartbeatTimeout"` |
| 41 | AllowPortsStr string `json:"allowPortsStr"` |
| 42 | TLSForce bool `json:"tlsForce"` |
| 43 | } |
| 44 |
| 45 | type V2SystemInfoStatusResp struct { |
| 46 | TotalTrafficIn int64 `json:"totalTrafficIn"` |
| 47 | TotalTrafficOut int64 `json:"totalTrafficOut"` |
| 48 | CurConns int64 `json:"curConns"` |
| 49 | ClientCounts int64 `json:"clientCounts"` |
| 50 | ProxyTypeCounts map[string]int64 `json:"proxyTypeCount"` |
| 51 | } |
| 52 |
| 53 | type V2SystemPruneResp struct { |
| 54 | Type string `json:"type"` |
| 55 | Cleared int `json:"cleared"` |
| 56 | Total int `json:"total"` |
| 57 | } |
| 58 |
| 59 | type V2UserResp struct { |
| 60 | User string `json:"user"` |
| 61 | ClientCount int `json:"clientCount"` |
| 62 | ProxyCount int `json:"proxyCount"` |
| 63 | } |
| 64 |
| 65 | type V2ClientDetailResp struct { |
| 66 | ClientInfoResp |
| 67 | Status V2ClientStatusResp `json:"status"` |
| 68 | } |
| 69 |
| 70 | type V2ClientStatusResp struct { |
| 71 | State string `json:"phase"` |
| 72 | CurConns int64 `json:"curConns"` |
| 73 | ProxyCount int64 `json:"proxyCount"` |
| 74 | } |
| 75 |
| 76 | type V2ProxyResp struct { |
| 77 | Name string `json:"name"` |
| 78 | User string `json:"user"` |
| 79 | ClientID string `json:"clientID"` |
| 80 | Spec V2ProxySpec `json:"spec"` |
| 81 | Status V2ProxyStatusResp `json:"status"` |
| 82 | } |
| 83 |
| 84 | type V2ProxySpec struct { |
| 85 | Type string `json:"type"` |
| 86 |
| 87 | TCP *V2TCPProxySpec `json:"tcp,omitempty"` |
| 88 | UDP *V2UDPProxySpec `json:"udp,omitempty"` |
| 89 | HTTP *V2HTTPProxySpec `json:"http,omitempty"` |
| 90 | HTTPS *V2HTTPSProxySpec `json:"https,omitempty"` |
| 91 | TCPMux *V2TCPMuxProxySpec `json:"tcpmux,omitempty"` |
| 92 | STCP *V2STCPProxySpec `json:"stcp,omitempty"` |
| 93 | SUDP *V2SUDPProxySpec `json:"sudp,omitempty"` |
| 94 | XTCP *V2XTCPProxySpec `json:"xtcp,omitempty"` |
| 95 | } |
| 96 |
| 97 | type V2ProxyBaseSpec struct { |
| 98 | Annotations map[string]string `json:"annotations,omitempty"` |
| 99 | Metadatas map[string]string `json:"metadatas,omitempty"` |
| 100 | Transport *V2ProxyTransportSpec `json:"transport,omitempty"` |
| 101 | LoadBalancer *V2ProxyLoadBalancerSpec `json:"loadBalancer,omitempty"` |
| 102 | } |
| 103 |
| 104 | type V2ProxyTransportSpec struct { |
| 105 | UseEncryption bool `json:"useEncryption"` |
| 106 | UseCompression bool `json:"useCompression"` |
| 107 | BandwidthLimit string `json:"bandwidthLimit"` |
| 108 | BandwidthLimitMode string `json:"bandwidthLimitMode"` |
| 109 | } |
| 110 |
| 111 | type V2ProxyLoadBalancerSpec struct { |
| 112 | Group string `json:"group"` |
| 113 | } |
| 114 |
| 115 | type V2TCPProxySpec struct { |
| 116 | V2ProxyBaseSpec |
| 117 | RemotePort *int `json:"remotePort,omitempty"` |
| 118 | } |
| 119 |
| 120 | type V2UDPProxySpec struct { |
| 121 | V2ProxyBaseSpec |
| 122 | RemotePort *int `json:"remotePort,omitempty"` |
| 123 | } |
| 124 |
| 125 | type V2HTTPProxySpec struct { |
| 126 | V2ProxyBaseSpec |
| 127 | CustomDomains []string `json:"customDomains,omitempty"` |
| 128 | Subdomain string `json:"subdomain,omitempty"` |
| 129 | Locations []string `json:"locations,omitempty"` |
| 130 | HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"` |
| 131 | } |
| 132 |
| 133 | type V2HTTPSProxySpec struct { |
| 134 | V2ProxyBaseSpec |
| 135 | CustomDomains []string `json:"customDomains,omitempty"` |
| 136 | Subdomain string `json:"subdomain,omitempty"` |
| 137 | } |
| 138 |
| 139 | type V2TCPMuxProxySpec struct { |
| 140 | V2ProxyBaseSpec |
| 141 | CustomDomains []string `json:"customDomains,omitempty"` |
| 142 | Subdomain string `json:"subdomain,omitempty"` |
| 143 | Multiplexer string `json:"multiplexer,omitempty"` |
| 144 | RouteByHTTPUser string `json:"routeByHTTPUser,omitempty"` |
| 145 | } |
| 146 |
| 147 | type V2STCPProxySpec struct { |
| 148 | V2ProxyBaseSpec |
| 149 | } |
| 150 |
| 151 | type V2SUDPProxySpec struct { |
| 152 | V2ProxyBaseSpec |
| 153 | } |
| 154 |
| 155 | type V2XTCPProxySpec struct { |
| 156 | V2ProxyBaseSpec |
| 157 | } |
| 158 |
| 159 | type V2ProxyStatusResp struct { |
| 160 | State string `json:"phase"` |
| 161 | TodayTrafficIn int64 `json:"todayTrafficIn"` |
| 162 | TodayTrafficOut int64 `json:"todayTrafficOut"` |
| 163 | CurConns int64 `json:"curConns"` |
| 164 | LastStartAt int64 `json:"lastStartAt,omitempty"` |
| 165 | LastCloseAt int64 `json:"lastCloseAt,omitempty"` |
| 166 | } |
| 167 |
| 168 | type V2ProxyTrafficResp struct { |
| 169 | Name string `json:"name"` |
| 170 | Unit string `json:"unit"` |
| 171 | Granularity string `json:"granularity"` |
| 172 | History []V2ProxyTrafficPointResp `json:"history"` |
| 173 | } |
| 174 |
| 175 | type V2ProxyTrafficPointResp struct { |
| 176 | Date string `json:"date"` |
| 177 | TrafficIn int64 `json:"trafficIn"` |
| 178 | TrafficOut int64 `json:"trafficOut"` |
| 179 | } |