frp报错 while decoding JSON: json: cannot unmarshal string into Go value of type

之前在研究frp如何使用时报错

error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go value of type v1.ServerConfig

不知道为什么,查了半天才知道原因,原来是因为frp0.53.2版本中配置文件是按照json格式编写的,如果是字符串格式的值是需要加双引号的,否则会报错。

比如:frps.toml配置文件中

vhostHTTPPort = 8080

bind_addr = “XXX.XXX.XXX.XXX”

bindPort = 7000

webServer.addr = “127.0.0.1”

webServer.port = 7500

webServer.user = “admin”

webServer.password = “admin”

log.to = “./frps.log”

log.level = “info”

log.maxDays = 3

bind_addr这种ip地址就是字符串,是必须加双引号的,如果不加,在启动frps时就会报错误,如下图。

报错图片

将ip地址加上双引号后,再执行就可以正常启动了。

正常启动

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/c20c2c5b0b.html