### Manage Plugin frp manage plugin is aim to extend frp's ability without modifing self code. It runs as a process and listen on a port to provide RPC interface. Before frps doing some operations, frps will send RPC requests to manage plugin and do operations by it's response. ### RPC request Support HTTP first. When manage plugin accept the operation request, it can give three different responses. * Reject operation and return the reason. * Allow operation and keep original content. * Allow operation and return modified content. ### Interface HTTP path can be configured for each manage plugin in frps. Assume here is `/handler`. Request ``` POST /handler { "version": "0.1.0", "op": "Login", "content": { ... // Operation info } } Request Header X-Frp-Reqid: for tracing ``` Response Error if not return 200 http code. Reject opeartion ``` { "reject": true, "reject_reason": "invalid user" } ``` Allow operation and keep original content ``` { "reject": false, "unchange": true } ``` Allow opeartion and modify content ``` { "unchange": "false", "content": { ... // Replaced content } } ``` ### Operation Now it supports `Login` and `NewProxy`. #### Login Client login operation ``` { "content": { "version": , "hostname": , "os": , "arch": , "user": , "timestamp": , "privilege_key": , "run_id": , "pool_count": , "metas": mapstring } } ``` #### NewProxy Create new proxy ``` { "content": { "user": { "user": , "metas": mapstring }, "proxy_name": , "proxy_type": , "use_encryption": , "use_compression": , "group": , "group_key": , // tcp and udp only "remote_port": , // http and https only "custom_domains": [], "subdomain": , "locations": , "http_user": , "http_pwd": , "host_header_rewrite": , "headers": mapstring, "metas": mapstring } } ``` ### manage plugin configure ```ini [common] bind_port = 7000 [plugin.user-manager] addr = 127.0.0.1:9000 path = /handler ops = Login [plugin.port-manager] addr = 127.0.0.1:9001 path = /handler ops = NewProxy ``` addr: plugin listen on. path: http request url path. ops: opeartions plugin needs handle. ### meta data Meta data will be sent to manage plugin in each RCP request. Meta data start with `meta_`. It can be configured in `common` and each proxy. ``` # frpc.ini [common] server_addr = 127.0.0.1 server_port = 7000 user = fake meta_token = fake meta_version = 1.0.0 [ssh] type = tcp local_port = 22 remote_port = 6000 meta_id = 123 ```