commit 52e53290ba1c4d6436cdb422fae9b4266bb18a65 Author: geek Date: Fri Apr 6 22:01:28 2018 +0900 project init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3733e36 --- /dev/null +++ b/.gitignore @@ -0,0 +1,68 @@ +# Created by .ignore support plugin (hsz.mobi) +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +### Go template +# Binaries for programs and plugins +*.exe +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 +.glide/ +.idea/ +*.iml + +vendor/ +glide.lock +.DS_Store +dist/ +debug diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2ca2b1d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,32 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug", + "type": "go", + "request": "launch", + "mode": "debug", + "remotePath": "", + "port": 2345, + "host": "127.0.0.1", + "program": "${workspaceRoot}/main.go", + "env": {}, + "args": [], + "showLog": true + }, + { + "name": "File Debug", + "type": "go", + "request": "launch", + "mode": "debug", + "remotePath": "", + "port": 2345, + "host": "127.0.0.1", + "program": "${fileDirname}", + "env": {}, + "args": [], + "showLog": true + } + + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..20af2f6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +// Place your settings in this file to overwrite default and user settings. +{ +} \ No newline at end of file diff --git a/config.json b/config.json new file mode 100644 index 0000000..4e40f67 --- /dev/null +++ b/config.json @@ -0,0 +1,67 @@ +{ + "server": { + "name": "Gateway WebApp", + "network": "tcp4", + "addr": "192.168.1.103:19090", + "tls": false, + "concurrency": 262144, + "maxStopWaitTime": 0 + }, + "auth": { + "signingKey": "tWB0lUXiCwX4U3qsJZcZ10mKvEH793RHkTJDbDuZVshQTk4uNB6ck59UQ96lhsRi4XNUiEnlIbP8XYQMPabeNtERX3iyHeDcwocgUVAor1nkAajYeq1gNyJszGpMhEOT" + }, + "websocket": { + "handshakeTimeout": 0, + "readBufferSize": 8192, + "writeBufferSize": 8192, + "enableCompression": false + }, + "gRPC": { + "addr": "192.168.1.50:50006", + "tls": false, + "pool": { + "maxIdle": 1, + "maxCapacity": 3, + "idleTimeout": 240, + "wait": false + } + }, + "redis": { + "network": "tcp", + "addr": "192.168.1.50:6379", + "tls": false, + "pool": { + "maxIdle": 1, + "maxCapacity": 3, + "idleTimeout": 240, + "wait": false + } + }, + "servlets": { + "webapp": { + "entry": "/webapp", + "socket": { + "maxMessageSize": 8192, + "writeTimeout": 0, + "readTimeout": 0, + "pongTimeout": 60, + "pingTimeout": 10, + "pingPeriod": 10, + "binaryMessage": false + } + }, + "file": { + "entry": "/file", + "socket": { + "maxMessageSize": 8192, + "writeTimeout": 0, + "readTimeout": 0, + "pongTimeout": 60, + "pingTimeout": 10, + "pingPeriod": 10, + "binaryMessage": false + } + } + + } +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..d10d79d --- /dev/null +++ b/main.go @@ -0,0 +1,58 @@ +package main + +import ( + //"flag" + //oocc "git.loafle.net/commons/configuration-go" + "git.loafle.net/commons/logging-go" + "git.loafle.net/overflow/member_gateway_rpc/server" + "log" + "os" + "os/signal" + "syscall" + "time" + "context" +) +// +//func init() { +// configDir = oocc.FlagConfigDir("./") +// logConfigPath = oocc.FlagLogConfigFilePath("") +// flag.Parse() +// +// logging.InitializeLogger(*logConfigPath) +// +// cc.SetConfigPath(*configDir) +// if err := cc.Load(&oogwc.Config, oocc.ConfigFileName); nil != err { +// logging.Logger().Panic(err) +// } +//} + +func init() { + logging.InitializeLogger("") +} + +func main() { + s := server.New() + + go func() { + err := s.ListenAndServe() + if nil != err { + log.Printf("err: %v", err) + } + }() + + interrupt := make(chan os.Signal, 1) + signal.Notify(interrupt, + syscall.SIGKILL, + syscall.SIGSTOP, + syscall.SIGHUP, + syscall.SIGINT, + syscall.SIGTERM, + syscall.SIGQUIT) + + <-interrupt + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + if err := s.Shutdown(ctx); err != nil { + logging.Logger().Errorf("error: %v", err) + } +} diff --git a/overFlow-private.key b/overFlow-private.key new file mode 100644 index 0000000..40d3195 --- /dev/null +++ b/overFlow-private.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKgIBAAKCAgEAsmcQLI5ZQQThoePzL4dTwuAxqGPIfNCqTirQxZesyXTOEX3o +QFLkd3s6dNHmFQIj1jVsFXDML5wRvv7YeI4a9wOrH+QR62KEzB6aT/yxSsVhNrLx +kQ35Xd9keGmfyMRNr72iiP8Hrm+7O0x2vlGUQp8+jMCzDVNlFvE5V9iqjSv4Q/AH +rURg5fH8JBIMZnhcz/kmNgWg2NByTFDiQXRjwBY5ts4Ylk8mZdAuumyiseXjE4l2 +JxdJJyRGqbx70wrC76MgTUvXEyw3MPSDGvN67PFYIJJwq5VpRNHeBMkNoPRWX6eE +9M1VNY+/rXuUGdg2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rywVTpU/Ppf7O1CADTb7eCNtvcTBaiMYFZ27gNquu1C5tQ2PsD +ht5czlvgneLzysxBCkKyR6+8floQC0Q09ke2T+I85LSTuAN1rvFEUgsGcA77eP+E +YiNc1rpb/UXmeBfApUDz5rfXDwYjrks6pcUgwIBNg7ZZSoos88skQjVafbWOlIPQ +d6tKnm+JJTIZww/TD365f1PWtkloc9q8ckGTDHkHl7Xig8O8C9Z0KCBIMFQ0wDkE +uqEg0d8BVp8sVJRN13SFXpB9nVePeMPJiJf9RZFWjCfSsTtLTeuyj7MjTgwc/QCY +g2BlKyI39HKu+tYHIJ3xoesBFgqhYoS0AQKCAQEA0E3oLbrGvq5U3SlDXmVzRNV6 +7vDhl9H7KJvNA4+C9XPDAyPNtzS1hYYlELSV4EW/G1GY9Mm0VSxLQrVMyhSCN/Ih +Tj7t4xfAevjYoI2XtXwjmjxKYznaL2t99g8NAzeK27Pa/z0J9tm9Uxm2akweGqsI +gJ6u7daFksV9JXQtbQ9nRmBQ1E7mYxjsTEDdPSEl+S4M4UjTE38OLpRZRv49vSNZ +wFjOnrpEETJY/eMhyyUgR2LNM2hrvd95QvykLpzVFguNQlsqCxWL8D81RSdSmDF9 +xdYsAuVTkhDWXwJ8hV95QxlurTu4rJgLBQA5gfxi20m8dWlO5KsMGyYqak3oWg== +-----END RSA PRIVATE KEY----- diff --git a/overFlow-public.pem b/overFlow-public.pem new file mode 100644 index 0000000..c4fae35 --- /dev/null +++ b/overFlow-public.pem @@ -0,0 +1,14 @@ +-----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsmcQLI5ZQQThoePzL4dT +wuAxqGPIfNCqTirQxZesyXTOEX3oQFLkd3s6dNHmFQIj1jVsFXDML5wRvv7YeI4a +9wOrH+QR62KEzB6aT/yxSsVhNrLxkQ35Xd9keGmfyMRNr72iiP8Hrm+7O0x2vlGU +Qp8+jMCzDVNlFvE5V9iqjSv4Q/AHrURg5fH8JBIMZnhcz/kmNgWg2NByTFDiQXRj +wBY5ts4Ylk8mZdAuumyiseXjE4l2JxdJJyRGqbx70wrC76MgTUvXEyw3MPSDGvN6 +7PFYIJJwq5VpRNHeBMkNoPRWX6eE9M1VNY+/rXuUGdg2ZxBzykAUjhjR9Iq/hawP +ZR78TaJ/w5wCVb7L6xIDqXb2JqhlFA4LHZmiDcR/m9Y2wI1DJkBeZpdxF1m19d5s +xs3vNNKzNVquKEz1QBfKnLvPxBXKpUT+zliCdzu1D/VU+veqDtKI8dmmGflc5lXe +DUYfPc7Kt4XLEZDSTBQlMgtkgE94ZcCJu6zdM3DrjPTh9OP5sG+/B5/KRYqZb4Yp +PGQ0TkXCaJjBtBEOM1FTk9/uhU/9b6lFbgc/quCkmz8Vxe5sJ98tXMi/F5q5n8ba +90AKaLUUwhTAxWV69NXweYtIMtKIj7AuI7IuK64iIyW+CE6BAl0QOlMtgF2/EqKW +ltvmbYpb+YgWOYJwa8F8pj0CAwEAAQ== +-----END PUBLIC KEY----- diff --git a/server/server-handler.go b/server/server-handler.go new file mode 100644 index 0000000..a8e4088 --- /dev/null +++ b/server/server-handler.go @@ -0,0 +1,13 @@ +package server + +import ( + ogrs "git.loafle.net/overflow/gateway_rpc/server" +) + +type ServerHandler interface { + ogrs.ServerHandler +} + +type ServerHandlers struct { + ogrs.ServerHandlers +} \ No newline at end of file diff --git a/server/server.go b/server/server.go new file mode 100644 index 0000000..6b10fbc --- /dev/null +++ b/server/server.go @@ -0,0 +1,19 @@ +package server + +import ( + csgw "git.loafle.net/commons/server-go/socket/web" + "git.loafle.net/overflow/member_gateway_rpc/servlet" +) + +func New() *csgw.Server { + rs := &servlet.RPCServlets{} + sh := &ServerHandlers{} + sh.RegisterServlet("/webapp", rs) + + s := &csgw.Server{ + ServerHandler: sh, + } + + return s +} + diff --git a/servlet/rpc-servlet.go b/servlet/rpc-servlet.go new file mode 100644 index 0000000..d0f03a8 --- /dev/null +++ b/servlet/rpc-servlet.go @@ -0,0 +1,12 @@ +package servlet + +import ( + ogrs "git.loafle.net/overflow/gateway_rpc/servlet" +) +type RPCServlet interface { + ogrs.RPCServlet +} + +type RPCServlets struct { + ogrs.RPCServlets +}