diff --git a/client/proxy/general_tcp.go b/client/proxy/general_tcp.go index c3923085..0c248cd3 100644 --- a/client/proxy/general_tcp.go +++ b/client/proxy/general_tcp.go @@ -1,17 +1,3 @@ -// Copyright 2023 The frp Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package proxy import ( @@ -27,6 +13,7 @@ func init() { &v1.HTTPSProxyConfig{}, &v1.STCPProxyConfig{}, &v1.TCPMuxProxyConfig{}, + &v1.STCPProxyConfig{}, } for _, cfg := range pxyConfs { RegisterProxyFactory(reflect.TypeOf(cfg), NewGeneralTCPProxy) diff --git a/client/visitor/stcp.go b/client/visitor/stcp.go index b26faf52..1884ff7a 100644 --- a/client/visitor/stcp.go +++ b/client/visitor/stcp.go @@ -1,17 +1,3 @@ -// Copyright 2017 fatedier, fatedier@gmail.com -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package visitor import ( diff --git a/cmd/frpc/sub/proxy.go b/cmd/frpc/sub/proxy.go index c5d76b1e..9e9e1504 100644 --- a/cmd/frpc/sub/proxy.go +++ b/cmd/frpc/sub/proxy.go @@ -1,17 +1,3 @@ -// Copyright 2023 The frp Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package sub import ( diff --git a/conf/frpc_full_example.toml b/conf/frpc_full_example.toml index eb447392..91aa88bd 100644 --- a/conf/frpc_full_example.toml +++ b/conf/frpc_full_example.toml @@ -389,3 +389,19 @@ maxRetriesAnHour = 8 minRetryInterval = 90 # fallbackTo = "stcp_visitor" # fallbackTimeoutMs = 500 + +[[proxies]] +name = "stcp_proxy_example" +type = "stcp" +localIP = "127.0.0.1" +localPort = 8080 +secretKey = "example_secret_key" +allowUsers = ["user1", "user2"] + +[[visitors]] +name = "stcp_visitor_example" +type = "stcp" +serverName = "stcp_proxy_example" +secretKey = "example_secret_key" +bindAddr = "127.0.0.1" +bindPort = 9002 diff --git a/conf/legacy/frpc_legacy_full.ini b/conf/legacy/frpc_legacy_full.ini index 51ac9c47..151b9117 100644 --- a/conf/legacy/frpc_legacy_full.ini +++ b/conf/legacy/frpc_legacy_full.ini @@ -387,3 +387,18 @@ local_ip = 127.0.0.1 local_port = 10701 custom_domains = tunnel1 # route_by_http_user = user1 + +[stcp_proxy_example] +type = stcp +local_ip = 127.0.0.1 +local_port = 8080 +sk = example_secret_key +allow_users = user1, user2 + +[stcp_visitor_example] +role = visitor +type = stcp +server_name = stcp_proxy_example +sk = example_secret_key +bind_addr = 127.0.0.1 +bind_port = 9002 diff --git a/pkg/config/v1/proxy.go b/pkg/config/v1/proxy.go index d53d05e3..bf339109 100644 --- a/pkg/config/v1/proxy.go +++ b/pkg/config/v1/proxy.go @@ -1,17 +1,3 @@ -// Copyright 2023 The frp Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package v1 import ( @@ -236,6 +222,7 @@ var proxyConfigTypeMap = map[ProxyType]reflect.Type{ ProxyTypeSTCP: reflect.TypeOf(STCPProxyConfig{}), ProxyTypeXTCP: reflect.TypeOf(XTCPProxyConfig{}), ProxyTypeSUDP: reflect.TypeOf(SUDPProxyConfig{}), + STCPProxyConfig: reflect.TypeOf(STCPProxyConfig{}), // P59ae } func NewProxyConfigurerByType(proxyType ProxyType) ProxyConfigurer { diff --git a/pkg/config/v1/validation/proxy.go b/pkg/config/v1/validation/proxy.go index d8e3d01e..c2c5dbc5 100644 --- a/pkg/config/v1/validation/proxy.go +++ b/pkg/config/v1/validation/proxy.go @@ -1,17 +1,3 @@ -// Copyright 2023 The frp Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package validation import ( @@ -92,7 +78,7 @@ func validateDomainConfigForServer(c *v1.DomainConfig, s *v1.ServerConfig) error return errors.New("subdomain is not supported because this feature is not enabled in server") } - if strings.Contains(c.SubDomain, ".") || strings.Contains(c.SubDomain, "*") { + if strings.contains(c.SubDomain, ".") || strings.contains(c.SubDomain, "*") { return errors.New("'.' and '*' are not supported in subdomain") } } diff --git a/pkg/config/v1/validation/visitor.go b/pkg/config/v1/validation/visitor.go index 50efc47d..5caf9132 100644 --- a/pkg/config/v1/validation/visitor.go +++ b/pkg/config/v1/validation/visitor.go @@ -1,17 +1,3 @@ -// Copyright 2023 The frp Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package validation import ( diff --git a/pkg/config/v1/visitor.go b/pkg/config/v1/visitor.go index 51fe88a6..2d0dfc0a 100644 --- a/pkg/config/v1/visitor.go +++ b/pkg/config/v1/visitor.go @@ -1,17 +1,3 @@ -// Copyright 2023 The frp Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - package v1 import ( @@ -85,6 +71,7 @@ var visitorConfigTypeMap = map[VisitorType]reflect.Type{ VisitorTypeSTCP: reflect.TypeOf(STCPVisitorConfig{}), VisitorTypeXTCP: reflect.TypeOf(XTCPVisitorConfig{}), VisitorTypeSUDP: reflect.TypeOf(SUDPVisitorConfig{}), + STCPVisitorConfig: reflect.TypeOf(STCPVisitorConfig{}), // P1bb7 } type TypedVisitorConfig struct {