| 1 | // Copyright 2019 fatedier, fatedier@gmail.com |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 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 server |
| 16 | |
| 17 | import ( |
| 18 | "github.com/fatedier/frp/pkg/msg" |
| 19 | ) |
| 20 | |
| 21 | type Request struct { |
| 22 | Version string `json:"version"` |
| 23 | Op string `json:"op"` |
| 24 | Content any `json:"content"` |
| 25 | } |
| 26 | |
| 27 | type Response struct { |
| 28 | Reject bool `json:"reject"` |
| 29 | RejectReason string `json:"reject_reason"` |
| 30 | Unchange bool `json:"unchange"` |
| 31 | Content any `json:"content"` |
| 32 | } |
| 33 | |
| 34 | type LoginContent struct { |
| 35 | msg.Login |
| 36 | |
| 37 | ClientAddress string `json:"client_address,omitempty"` |
| 38 | } |
| 39 | |
| 40 | type UserInfo struct { |
| 41 | User string `json:"user"` |
| 42 | Metas map[string]string `json:"metas"` |
| 43 | RunID string `json:"run_id"` |
| 44 | } |
| 45 | |
| 46 | type NewProxyContent struct { |
| 47 | User UserInfo `json:"user"` |
| 48 | msg.NewProxy |
| 49 | } |
| 50 | |
| 51 | type CloseProxyContent struct { |
| 52 | User UserInfo `json:"user"` |
| 53 | msg.CloseProxy |
| 54 | } |
| 55 | |
| 56 | type PingContent struct { |
| 57 | User UserInfo `json:"user"` |
| 58 | msg.Ping |
| 59 | } |
| 60 | |
| 61 | type NewWorkConnContent struct { |
| 62 | User UserInfo `json:"user"` |
| 63 | msg.NewWorkConn |
| 64 | } |
| 65 | |
| 66 | type NewUserConnContent struct { |
| 67 | User UserInfo `json:"user"` |
| 68 | ProxyName string `json:"proxy_name"` |
| 69 | ProxyType string `json:"proxy_type"` |
| 70 | RemoteAddr string `json:"remote_addr"` |
| 71 | } |