正在查看旧版本。 查看 当前版本.

与当前比较 查看页面历史记录

版本 1 下一个 »

本地设备的webssh功能

增加jsoncmd的解析命令

	int CWebSSH::Handle(HTTPServerRequest &request, CJSRPCResponseMaker &response, Poco::URI &uri)
	{
		response.BeginResult();
		response.BeginObj(NULL);

    	response.AddMemberString("url", " http://192.168.1.198:8080");

		response.EndObj();
		response.EndResult();
		return 0;
	}

	const char *CWebSSH::GetName()
	{
		return "webssh";
	}

效果如下




部署frp功能

# 服务端
docker run --restart=always --network host -d -v /etc/frp/frps.toml:/etc/frp/frps.toml --name frps snowdreamtech/frps

# 客户端
docker run --restart=always --network host -d -v /etc/frp/frpc.toml:/etc/frp/frpc.toml --name frpc snowdreamtech/frpc


配置如下

服务端 /etc/frp/frps.toml

bindAddr = "0.0.0.0"
bindPort = 9000
quicBindPort = 9000

transport.maxPoolCount = 2000
transport.tcpMux = true
transport.tcpMuxKeepaliveInterval = 60
transport.tcpKeepalive = 7200
transport.tls.force = false

webServer.addr = "0.0.0.0"
webServer.port = 9003
webServer.user = "admin"
webServer.password = "msj123"
webServer.pprofEnable = false

log.to = "./frps.log"
log.level = "info"
log.maxDays = 3
log.disablePrintColor = false

auth.method = "token"
auth.token = "msj123"

allowPorts = [
  { start = 60000, end = 65535 }
]

maxPortsPerClient = 1024
udpPacketSize = 1500
natholeAnalysisDataReserveHours = 168


客户端 /etc/frp/frpc.toml

serverAddr = "49.234.66.123"
serverPort = 9000

auth.method = "token"
auth.token = "msj123"

webServer.addr = "0.0.0.0"
webServer.port = 9003
webServer.user = "admin"
webServer.password = "msj123"
webServer.pprofEnable = false

[[proxies]]
name = "192.168.1.27-ssh"
type = "tcp"
localIP = "192.168.1.27"
localPort = 22
remotePort = 60120


服务端需要配置安全组,开发对应的端口

9000为服务端给客户端提供的连接端口

9003为服务端的控制面板

60000~65535为客户端的映射端口


查看服务端控制面板,客户端已经注册成功,并且已经将ssh端口映射到公网使用





  • 无标签