| // |
| 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 | import ( |
| 18 | v1 "github.com/fatedier/frp/pkg/config/v1" |
| 19 | ) |
| 20 |
| 21 | type ServerInfoResp struct { |
| 22 | Version string `json:"version"` |
| 23 | BindPort int `json:"bindPort"` |
| 24 | VhostHTTPPort int `json:"vhostHTTPPort"` |
| 25 | VhostHTTPSPort int `json:"vhostHTTPSPort"` |
| 26 | TCPMuxHTTPConnectPort int `json:"tcpmuxHTTPConnectPort"` |
| 27 | KCPBindPort int `json:"kcpBindPort"` |
| 28 | QUICBindPort int `json:"quicBindPort"` |
| 29 | SubdomainHost string `json:"subdomainHost"` |
| 30 | MaxPoolCount int64 `json:"maxPoolCount"` |
| 31 | MaxPortsPerClient int64 `json:"maxPortsPerClient"` |
| 32 | HeartBeatTimeout int64 `json:"heartbeatTimeout"` |
| 33 | AllowPortsStr string `json:"allowPortsStr,omitempty"` |
| 34 | TLSForce bool `json:"tlsForce,omitempty"` |
| 35 |
| 36 | TotalTrafficIn int64 `json:"totalTrafficIn"` |
| 37 | TotalTrafficOut int64 `json:"totalTrafficOut"` |
| 38 | CurConns int64 `json:"curConns"` |
| 39 | ClientCounts int64 `json:"clientCounts"` |
| 40 | ProxyTypeCounts map[string]int64 `json:"proxyTypeCount"` |
| 41 | } |
| 42 |
| 43 | type ClientInfoResp struct { |
| 44 | Key string `json:"key"` |
| 45 | User string `json:"user"` |
| 46 | ClientID string `json:"clientID"` |
| 47 | RunID string `json:"runID"` |
| 48 | Version string `json:"version,omitempty"` |
| 49 | WireProtocol string `json:"wireProtocol,omitempty"` |
| 50 | Hostname string `json:"hostname"` |
| 51 | ClientIP string `json:"clientIP,omitempty"` |
| 52 | FirstConnectedAt int64 `json:"firstConnectedAt"` |
| 53 | LastConnectedAt int64 `json:"lastConnectedAt"` |
| 54 | DisconnectedAt int64 `json:"disconnectedAt,omitempty"` |
| 55 | Online bool `json:"online"` |
| 56 | } |
| 57 |
| 58 | type BaseOutConf struct { |
| 59 | v1.ProxyBaseConfig |
| 60 | } |
| 61 |
| 62 | type TCPOutConf struct { |
| 63 | BaseOutConf |
| 64 | RemotePort int `json:"remotePort"` |
| 65 | } |
| 66 |
| 67 | type TCPMuxOutConf struct { |
| 68 | BaseOutConf |
| 69 | v1.DomainConfig |
| 70 | Multiplexer string `json:"multiplexer"` |
| 71 | RouteByHTTPUser string `json:"routeByHTTPUser"` |
| 72 | } |
| 73 |
| 74 | type UDPOutConf struct { |
| 75 | BaseOutConf |
| 76 | RemotePort int `json:"remotePort"` |
| 77 | } |
| 78 |
| 79 | type HTTPOutConf struct { |
| 80 | BaseOutConf |
| 81 | v1.DomainConfig |
| 82 | Locations []string `json:"locations"` |
| 83 | HostHeaderRewrite string `json:"hostHeaderRewrite"` |
| 84 | } |
| 85 |
| 86 | type HTTPSOutConf struct { |
| 87 | BaseOutConf |
| 88 | v1.DomainConfig |
| 89 | } |
| 90 |
| 91 | type STCPOutConf struct { |
| 92 | BaseOutConf |
| 93 | } |
| 94 |
| 95 | type XTCPOutConf struct { |
| 96 | BaseOutConf |
| 97 | } |
| 98 |
| 99 | // Get proxy info. |
| 100 | type ProxyStatsInfo struct { |
| 101 | Name string `json:"name"` |
| 102 | Conf any `json:"conf"` |
| 103 | User string `json:"user,omitempty"` |
| 104 | ClientID string `json:"clientID,omitempty"` |
| 105 | TodayTrafficIn int64 `json:"todayTrafficIn"` |
| 106 | TodayTrafficOut int64 `json:"todayTrafficOut"` |
| 107 | CurConns int64 `json:"curConns"` |
| 108 | LastStartTime string `json:"lastStartTime"` |
| 109 | LastCloseTime string `json:"lastCloseTime"` |
| 110 | Status string `json:"status"` |
| 111 | } |
| 112 |
| 113 | type GetProxyInfoResp struct { |
| 114 | Proxies []*ProxyStatsInfo `json:"proxies"` |
| 115 | } |
| 116 |
| 117 | // Get proxy info by name. |
| 118 | type GetProxyStatsResp struct { |
| 119 | Name string `json:"name"` |
| 120 | Conf any `json:"conf"` |
| 121 | User string `json:"user,omitempty"` |
| 122 | ClientID string `json:"clientID,omitempty"` |
| 123 | TodayTrafficIn int64 `json:"todayTrafficIn"` |
| 124 | TodayTrafficOut int64 `json:"todayTrafficOut"` |
| 125 | CurConns int64 `json:"curConns"` |
| 126 | LastStartTime string `json:"lastStartTime"` |
| 127 | LastCloseTime string `json:"lastCloseTime"` |
| 128 | Status string `json:"status"` |
| 129 | } |
| 130 |
| 131 | // /api/traffic/:name |
| 132 | type GetProxyTrafficResp struct { |
| 133 | Name string `json:"name"` |
| 134 | TrafficIn []int64 `json:"trafficIn"` |
| 135 | TrafficOut []int64 `json:"trafficOut"` |
| 136 | } |