beiwei30 commented on a change in pull request #68: URL: https://github.com/apache/dubbo-go-samples/pull/68#discussion_r599204937
########## File path: tls/go-client/cmd/client.go ########## @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 main + +import ( + "context" + "fmt" + "os" + "os/signal" + "path/filepath" + "syscall" + "time" +) + +import ( + getty "github.com/apache/dubbo-getty" + hessian "github.com/apache/dubbo-go-hessian2" + gxlog "github.com/dubbogo/gost/log" + "github.com/apache/dubbo-go-samples/tls/go-client/pkg" Review comment: put "tls/go-client/pkg" into separated import group, and combine others into the group below. ########## File path: tls/go-server/cmd/server.go ########## @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 main + +import ( + "fmt" + "os" + "os/signal" + "path/filepath" + "syscall" + "time" +) + +import ( + getty "github.com/apache/dubbo-getty" + "github.com/apache/dubbo-go-samples/tls/go-server/pkg" Review comment: again, pls. regroup the import. Move 'tls/go-server/pkg' into separated package. ########## File path: tls/go-server/conf/server.yml ########## @@ -0,0 +1,57 @@ +# dubbo server yaml configure file + + +# application config +application: + organization : "ikurento.com" + name : "BDTService" + module : "dubbogo user-info server" + version : "0.0.1" + owner : "ZX" + environment : "dev" + +registries : + "demoZk": + protocol: "zookeeper" + timeout : "3s" + address: "127.0.0.1:2181" + +services: + "UserProvider": + # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册 Review comment: remote this line of comment ########## File path: tls/go-server/cmd/server.go ########## @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 main + +import ( + "fmt" + "os" + "os/signal" + "path/filepath" + "syscall" + "time" +) + +import ( + getty "github.com/apache/dubbo-getty" + "github.com/apache/dubbo-go-samples/tls/go-server/pkg" + hessian "github.com/apache/dubbo-go-hessian2" +) + +import ( + "github.com/apache/dubbo-go/common/logger" + "github.com/apache/dubbo-go/config" + _ "github.com/apache/dubbo-go/protocol/dubbo" + _ "github.com/apache/dubbo-go/registry/protocol" + _ "github.com/apache/dubbo-go/common/proxy/proxy_factory" + _ "github.com/apache/dubbo-go/filter/filter_impl" + _ "github.com/apache/dubbo-go/cluster/cluster_impl" + _ "github.com/apache/dubbo-go/cluster/loadbalance" + _ "github.com/apache/dubbo-go/registry/zookeeper" +) + +// 生存时间 +var ( + survivalTimeout = int(3e9) +) + +func init(){ + serverPemPath, _ := filepath.Abs("../certs/server.pem") + serverKeyPath, _ := filepath.Abs("../certs/server.key") + caPemPath, _ := filepath.Abs("../certs/ca.pem") + config.SetSslEnabled(true) + config.SetServerTlsConfigBuilder(&getty.ServerTlsConfigBuilder{ + ServerKeyCertChainPath: serverPemPath, + ServerPrivateKeyPath: serverKeyPath, + ServerTrustCertCollectionPath: caPemPath, + }) +} + +/* + 需要配置环境变量 + export CONF_PROVIDER_FILE_PATH="xx" + export APP_LOG_CONF_FILE="xx" + */ + +func main() { + // 在运行的时候序列化 + hessian.RegisterPOJO(&pkg.User{}) + // 加载配置 + config.Load() + // 优雅的结束程序 + initSignal() +} + +// 优雅的结束程序 Review comment: use English for comments. ########## File path: tls/go-client/conf/client.yml ########## @@ -0,0 +1,61 @@ +# dubbo client yaml configure file + + +check: true +# client +request_timeout : "3s" +# connect timeout +connect_timeout : "3s" + +# application config +application: + organization : "ikurento.com" + name : "BDTService" + module : "dubbogo user-info client" + version : "0.0.1" + owner : "ZX" + environment : "dev" + +registries : + "demoZk": + protocol: "zookeeper" + timeout : "3s" + address: "127.0.0.1:2181" + usern ame: "" + password: "" + + +references: + "UserProvider": + # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册 Review comment: remove this line of comment. ########## File path: tls/go-server/cmd/server.go ########## @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 main + +import ( + "fmt" + "os" + "os/signal" + "path/filepath" + "syscall" + "time" +) + +import ( + getty "github.com/apache/dubbo-getty" + "github.com/apache/dubbo-go-samples/tls/go-server/pkg" + hessian "github.com/apache/dubbo-go-hessian2" +) + +import ( + "github.com/apache/dubbo-go/common/logger" + "github.com/apache/dubbo-go/config" + _ "github.com/apache/dubbo-go/protocol/dubbo" + _ "github.com/apache/dubbo-go/registry/protocol" + _ "github.com/apache/dubbo-go/common/proxy/proxy_factory" + _ "github.com/apache/dubbo-go/filter/filter_impl" + _ "github.com/apache/dubbo-go/cluster/cluster_impl" + _ "github.com/apache/dubbo-go/cluster/loadbalance" + _ "github.com/apache/dubbo-go/registry/zookeeper" +) + +// 生存时间 +var ( + survivalTimeout = int(3e9) +) + +func init(){ + serverPemPath, _ := filepath.Abs("../certs/server.pem") + serverKeyPath, _ := filepath.Abs("../certs/server.key") + caPemPath, _ := filepath.Abs("../certs/ca.pem") + config.SetSslEnabled(true) + config.SetServerTlsConfigBuilder(&getty.ServerTlsConfigBuilder{ + ServerKeyCertChainPath: serverPemPath, + ServerPrivateKeyPath: serverKeyPath, + ServerTrustCertCollectionPath: caPemPath, + }) +} + +/* Review comment: use English for comments. ########## File path: tls/go-server/cmd/server.go ########## @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 main + +import ( + "fmt" + "os" + "os/signal" + "path/filepath" + "syscall" + "time" +) + +import ( + getty "github.com/apache/dubbo-getty" + "github.com/apache/dubbo-go-samples/tls/go-server/pkg" + hessian "github.com/apache/dubbo-go-hessian2" +) + +import ( + "github.com/apache/dubbo-go/common/logger" + "github.com/apache/dubbo-go/config" + _ "github.com/apache/dubbo-go/protocol/dubbo" + _ "github.com/apache/dubbo-go/registry/protocol" + _ "github.com/apache/dubbo-go/common/proxy/proxy_factory" + _ "github.com/apache/dubbo-go/filter/filter_impl" + _ "github.com/apache/dubbo-go/cluster/cluster_impl" + _ "github.com/apache/dubbo-go/cluster/loadbalance" + _ "github.com/apache/dubbo-go/registry/zookeeper" +) + +// 生存时间 +var ( + survivalTimeout = int(3e9) +) + +func init(){ + serverPemPath, _ := filepath.Abs("../certs/server.pem") + serverKeyPath, _ := filepath.Abs("../certs/server.key") + caPemPath, _ := filepath.Abs("../certs/ca.pem") + config.SetSslEnabled(true) + config.SetServerTlsConfigBuilder(&getty.ServerTlsConfigBuilder{ + ServerKeyCertChainPath: serverPemPath, + ServerPrivateKeyPath: serverKeyPath, + ServerTrustCertCollectionPath: caPemPath, + }) +} + +/* + 需要配置环境变量 + export CONF_PROVIDER_FILE_PATH="xx" + export APP_LOG_CONF_FILE="xx" + */ + +func main() { + // 在运行的时候序列化 + hessian.RegisterPOJO(&pkg.User{}) + // 加载配置 Review comment: use English for comments. ########## File path: tls/go-server/cmd/server.go ########## @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 main + +import ( + "fmt" + "os" + "os/signal" + "path/filepath" + "syscall" + "time" +) + +import ( + getty "github.com/apache/dubbo-getty" + "github.com/apache/dubbo-go-samples/tls/go-server/pkg" + hessian "github.com/apache/dubbo-go-hessian2" +) + +import ( + "github.com/apache/dubbo-go/common/logger" + "github.com/apache/dubbo-go/config" + _ "github.com/apache/dubbo-go/protocol/dubbo" + _ "github.com/apache/dubbo-go/registry/protocol" + _ "github.com/apache/dubbo-go/common/proxy/proxy_factory" + _ "github.com/apache/dubbo-go/filter/filter_impl" + _ "github.com/apache/dubbo-go/cluster/cluster_impl" + _ "github.com/apache/dubbo-go/cluster/loadbalance" + _ "github.com/apache/dubbo-go/registry/zookeeper" +) + +// 生存时间 Review comment: use English for comments. ########## File path: tls/go-server/cmd/server.go ########## @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 main + +import ( + "fmt" + "os" + "os/signal" + "path/filepath" + "syscall" + "time" +) + +import ( + getty "github.com/apache/dubbo-getty" + "github.com/apache/dubbo-go-samples/tls/go-server/pkg" + hessian "github.com/apache/dubbo-go-hessian2" +) + +import ( + "github.com/apache/dubbo-go/common/logger" + "github.com/apache/dubbo-go/config" + _ "github.com/apache/dubbo-go/protocol/dubbo" + _ "github.com/apache/dubbo-go/registry/protocol" + _ "github.com/apache/dubbo-go/common/proxy/proxy_factory" + _ "github.com/apache/dubbo-go/filter/filter_impl" + _ "github.com/apache/dubbo-go/cluster/cluster_impl" + _ "github.com/apache/dubbo-go/cluster/loadbalance" + _ "github.com/apache/dubbo-go/registry/zookeeper" +) + +// 生存时间 +var ( + survivalTimeout = int(3e9) +) + +func init(){ + serverPemPath, _ := filepath.Abs("../certs/server.pem") + serverKeyPath, _ := filepath.Abs("../certs/server.key") + caPemPath, _ := filepath.Abs("../certs/ca.pem") + config.SetSslEnabled(true) + config.SetServerTlsConfigBuilder(&getty.ServerTlsConfigBuilder{ + ServerKeyCertChainPath: serverPemPath, + ServerPrivateKeyPath: serverKeyPath, + ServerTrustCertCollectionPath: caPemPath, + }) +} + +/* + 需要配置环境变量 + export CONF_PROVIDER_FILE_PATH="xx" + export APP_LOG_CONF_FILE="xx" + */ + +func main() { + // 在运行的时候序列化 + hessian.RegisterPOJO(&pkg.User{}) + // 加载配置 + config.Load() + // 优雅的结束程序 Review comment: use English for comments. ########## File path: tls/go-server/cmd/server.go ########## @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 main + +import ( + "fmt" + "os" + "os/signal" + "path/filepath" + "syscall" + "time" +) + +import ( + getty "github.com/apache/dubbo-getty" + "github.com/apache/dubbo-go-samples/tls/go-server/pkg" + hessian "github.com/apache/dubbo-go-hessian2" +) + +import ( + "github.com/apache/dubbo-go/common/logger" + "github.com/apache/dubbo-go/config" + _ "github.com/apache/dubbo-go/protocol/dubbo" + _ "github.com/apache/dubbo-go/registry/protocol" + _ "github.com/apache/dubbo-go/common/proxy/proxy_factory" + _ "github.com/apache/dubbo-go/filter/filter_impl" + _ "github.com/apache/dubbo-go/cluster/cluster_impl" + _ "github.com/apache/dubbo-go/cluster/loadbalance" + _ "github.com/apache/dubbo-go/registry/zookeeper" +) + +// 生存时间 +var ( + survivalTimeout = int(3e9) +) + +func init(){ + serverPemPath, _ := filepath.Abs("../certs/server.pem") + serverKeyPath, _ := filepath.Abs("../certs/server.key") + caPemPath, _ := filepath.Abs("../certs/ca.pem") + config.SetSslEnabled(true) + config.SetServerTlsConfigBuilder(&getty.ServerTlsConfigBuilder{ + ServerKeyCertChainPath: serverPemPath, + ServerPrivateKeyPath: serverKeyPath, + ServerTrustCertCollectionPath: caPemPath, + }) +} + +/* + 需要配置环境变量 + export CONF_PROVIDER_FILE_PATH="xx" + export APP_LOG_CONF_FILE="xx" + */ + +func main() { + // 在运行的时候序列化 Review comment: use English for comments. ########## File path: tls/go-client/pkg/user.go ########## @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 pkg + +import ( + "context" + "time" +) + +type User struct { Review comment: pls. reformat the code. ########## File path: tls/go-server/conf/server.yml ########## @@ -0,0 +1,57 @@ +# dubbo server yaml configure file + + +# application config +application: + organization : "ikurento.com" + name : "BDTService" + module : "dubbogo user-info server" + version : "0.0.1" + owner : "ZX" + environment : "dev" + +registries : + "demoZk": + protocol: "zookeeper" + timeout : "3s" + address: "127.0.0.1:2181" + +services: + "UserProvider": + # 可以指定多个registry,使用逗号隔开;不指定默认向所有注册中心注册 + registry: "demoZk" + protocol : "dubbo" + # 相当于dubbo.xml中的interface Review comment: remove this line. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
