diff --git a/api/v1alpha1/upstream_types.go b/api/v1alpha1/upstream_types.go index df70a4e..2bf0c74 100644 --- a/api/v1alpha1/upstream_types.go +++ b/api/v1alpha1/upstream_types.go @@ -27,6 +27,9 @@ type UpstreamSpec struct { } type UpstreamSpec_TCP struct { + Name string `json:"name"` + Type string `json:"type"` + SubDomain string `json:"subdomain"` Host string `json:"host"` Port int `json:"port"` Server UpstreamSpec_TCP_Server `json:"server"` diff --git a/pkg/client/builder/configmap_builder.go b/pkg/client/builder/configmap_builder.go index 2d4d1f4..ffade40 100644 --- a/pkg/client/builder/configmap_builder.go +++ b/pkg/client/builder/configmap_builder.go @@ -32,7 +32,7 @@ func (n *ConfigMapBuilder) SetNamespace(namespace string) *ConfigMapBuilder { func (n *ConfigMapBuilder) Build() (*corev1.ConfigMap, error) { data := make(map[string]string) - data["config.ini"] = n.Config + data["config.toml"] = n.Config configMap := &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ diff --git a/pkg/client/builder/pod_builder.go b/pkg/client/builder/pod_builder.go index 022b52c..4f9ab8d 100644 --- a/pkg/client/builder/pod_builder.go +++ b/pkg/client/builder/pod_builder.go @@ -49,7 +49,7 @@ func (n *PodBuilder) Build() (*corev1.Pod, error) { { Name: "frpc", Image: n.Image, - Command: []string{"frpc", "-c", "/frp/config.ini"}, + Command: []string{"frpc", "-c", "/frp/config.toml"}, Ports: []corev1.ContainerPort{ {ContainerPort: int32(4040)}, }, diff --git a/pkg/client/models/config.go b/pkg/client/models/config.go index d35d025..26e4509 100644 --- a/pkg/client/models/config.go +++ b/pkg/client/models/config.go @@ -55,6 +55,9 @@ type Upstream struct { } type Upstream_TCP struct { + Name string + Type string + SubDomain string Host string Port int ServerPort int diff --git a/pkg/client/utils/template.go b/pkg/client/utils/template.go index 8cbd2e8..c2b285a 100644 --- a/pkg/client/utils/template.go +++ b/pkg/client/utils/template.go @@ -1,30 +1,34 @@ package utils const CLIENT_TEMPLATE = ` +# frpc.toml [common] -server_addr = {{ .Common.ServerAddress }} -server_port = {{ .Common.ServerPort }} +serverAddr = {{ .Common.ServerAddress }} +serverPort = {{ .Common.ServerPort }} {{ if eq .Common.ServerAuthentication.Type 1 }} -token = {{ .Common.ServerAuthentication.Token }} +auth.method = "token" +auth.token = {{ .Common.ServerAuthentication.Token }} {{ end }} -admin_addr = {{ .Common.AdminAddress }} -admin_port = {{ .Common.AdminPort }} -admin_user = {{ .Common.AdminUsername }} -admin_pwd = {{ .Common.AdminPassword }} +webServer.addr = {{ .Common.AdminAddress }} +webServer.port = {{ .Common.AdminPort }} +webServer.user = {{ .Common.AdminUsername }} +webServer.password = {{ .Common.AdminPassword }} {{ range $upstream := .Upstreams }} [{{ $upstream.Name }}] {{ if eq $upstream.Type 1 }} -type = tcp -local_ip = {{ $upstream.TCP.Host }} -local_port = {{ $upstream.TCP.Port }} -remote_port = {{ $upstream.TCP.ServerPort }} +name = {{ $upstream.TCP.Name }} +type = {{ $upstream.TCP.Type }} +subdomain = {{ $upstream.TCP.SubDomain }} +localIP = {{ $upstream.TCP.Host }} +localPort = {{ $upstream.TCP.Port }} +remotePort = {{ $upstream.TCP.ServerPort }} {{ if $upstream.TCP.ProxyProtocol }} -proxy_protocol_version = {{ $upstream.TCP.ProxyProtocol }} +transport.proxyProtocolVersion = {{ $upstream.TCP.ProxyProtocol }} {{ end }} -use_encryption = true +transport.useEncryption = true {{ end }} {{ end }} `