diff --git a/pkg/client/utils/template.go b/pkg/client/utils/template.go index 0222ae6..b177d10 100644 --- a/pkg/client/utils/template.go +++ b/pkg/client/utils/template.go @@ -2,33 +2,32 @@ package utils const CLIENT_TEMPLATE = ` # frpc.toml -[common] -serverAddr = {{ .Common.ServerAddress }} +serverAddr = "{{ .Common.ServerAddress }}" serverPort = {{ .Common.ServerPort }} {{ if eq .Common.ServerAuthentication.Type 1 }} auth.method = "token" -auth.token = {{ .Common.ServerAuthentication.Token }} +auth.token = "{{ .Common.ServerAuthentication.Token }}" {{ end }} -webServer.addr = {{ .Common.AdminAddress }} +webServer.addr = "{{ .Common.AdminAddress }}" webServer.port = {{ .Common.AdminPort }} -webServer.user = {{ .Common.AdminUsername }} -webServer.password = {{ .Common.AdminPassword }} +webServer.user = "{{ .Common.AdminUsername }}" +webServer.password = "{{ .Common.AdminPassword }}" {{ range $upstream := .Upstreams }} -[{{ $upstream.Name }}] +[[proxies]] {{ if eq $upstream.Type 1 }} -name = {{ $upstream.Name }} -type = tcp -localIP = {{ $upstream.TCP.Host }} +name = "{{ $upstream.Name }}" +type = "tcp" +localIP = "{{ $upstream.TCP.Host }}" localPort = {{ $upstream.TCP.Port }} remotePort = {{ $upstream.TCP.ServerPort }} {{ if $upstream.TCP.ProxyProtocol }} -transport.proxyProtocolVersion = {{ $upstream.TCP.ProxyProtocol }} +transport.proxyProtocolVersion = "{{ $upstream.TCP.ProxyProtocol }}" {{ end }} @@ -43,11 +42,11 @@ transport.useEncryption = true {{ end }} {{ if eq $upstream.Type 2 }} -name = {{ $upstream.Name }} -type = udp -localIP = {{ $upstream.TCP.Host }} -localPort = {{ $upstream.TCP.Port }} -remotePort = {{ $upstream.TCP.ServerPort }} +name = "{{ $upstream.Name }}" +type = "udp" +localIP = "{{ $upstream.UDP.Host }}" +localPort = {{ $upstream.UDP.Port }} +remotePort = {{ $upstream.UDP.ServerPort }} {{ end }} {{ end }}