From c42985f778a06f68ac419d803bbd3adf611bf81a Mon Sep 17 00:00:00 2001 From: crusader Date: Tue, 19 Sep 2017 17:22:14 +0900 Subject: [PATCH] Project has been created. --- .gitignore | 68 +++++++++++++++++++++++++++++++++++++++++++ .vscode/launch.json | 32 ++++++++++++++++++++ .vscode/settings.json | 3 ++ auth.go | 5 ++++ grpc.go | 6 ++++ handler.go | 6 ++++ pool.go | 10 +++++++ redis.go | 6 ++++ server.go | 7 +++++ socket.go | 13 +++++++++ websocket.go | 10 +++++++ 11 files changed, 166 insertions(+) create mode 100644 .gitignore create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 auth.go create mode 100644 grpc.go create mode 100644 handler.go create mode 100644 pool.go create mode 100644 redis.go create mode 100644 server.go create mode 100644 socket.go create mode 100644 websocket.go 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/auth.go b/auth.go new file mode 100644 index 0000000..186f4ab --- /dev/null +++ b/auth.go @@ -0,0 +1,5 @@ +package config + +type Auth struct { + SigningKey string `json:"signingKey" yaml:"signingKey" toml:"signingKey"` +} diff --git a/grpc.go b/grpc.go new file mode 100644 index 0000000..1424bc7 --- /dev/null +++ b/grpc.go @@ -0,0 +1,6 @@ +package config + +type GRPC struct { + Server + Pool Pool `json:"pool" yaml:"pool" toml:"pool"` +} diff --git a/handler.go b/handler.go new file mode 100644 index 0000000..45c6998 --- /dev/null +++ b/handler.go @@ -0,0 +1,6 @@ +package config + +type Handler struct { + Entry string `json:"entry" yaml:"entry" toml:"entry"` + Socket Socket `json:"socket" yaml:"socket" toml:"socket"` +} diff --git a/pool.go b/pool.go new file mode 100644 index 0000000..d3c8007 --- /dev/null +++ b/pool.go @@ -0,0 +1,10 @@ +package config + +import "time" + +type Pool struct { + MaxIdle int `json:"maxIdle" yaml:"maxIdle" toml:"maxIdle"` + IdleTimeout time.Duration `json:"idleTimeout" yaml:"idleTimeout" toml:"idleTimeout"` + MaxCapacity int `json:"maxCapacity" yaml:"maxCapacity" toml:"maxCapacity"` + IncreaseCapacity int `json:"increaseCapacity" yaml:"increaseCapacity" toml:"increaseCapacity"` +} diff --git a/redis.go b/redis.go new file mode 100644 index 0000000..0a52f07 --- /dev/null +++ b/redis.go @@ -0,0 +1,6 @@ +package config + +type Redis struct { + Server + Pool Pool `json:"pool" yaml:"pool" toml:"pool"` +} diff --git a/server.go b/server.go new file mode 100644 index 0000000..14f1f39 --- /dev/null +++ b/server.go @@ -0,0 +1,7 @@ +package config + +type Server struct { + Network string `json:"network" yaml:"network" toml:"network"` + Addr string `json:"addr" yaml:"addr" toml:"addr"` + TLS bool `json:"tls" yaml:"tls" toml:"tls"` +} diff --git a/socket.go b/socket.go new file mode 100644 index 0000000..5c809f6 --- /dev/null +++ b/socket.go @@ -0,0 +1,13 @@ +package config + +import "time" + +type Socket struct { + MaxMessageSize int64 `json:"maxMessageSize" yaml:"maxMessageSize" toml:"maxMessageSize"` + WriteTimeout time.Duration `json:"writeTimeout" yaml:"writeTimeout" toml:"writeTimeout"` + ReadTimeout time.Duration `json:"readTimeout" yaml:"readTimeout" toml:"readTimeout"` + PongTimeout time.Duration `json:"pongTimeout" yaml:"pongTimeout" toml:"pongTimeout"` + PingTimeout time.Duration `json:"pingTimeout" yaml:"pingTimeout" toml:"pingTimeout"` + PingPeriod time.Duration `json:"pingPeriod" yaml:"pingPeriod" toml:"pingPeriod"` + BinaryMessage bool `json:"binaryMessage" yaml:"binaryMessage" toml:"binaryMessage"` +} diff --git a/websocket.go b/websocket.go new file mode 100644 index 0000000..42a187c --- /dev/null +++ b/websocket.go @@ -0,0 +1,10 @@ +package config + +import "time" + +type Websocket struct { + HandshakeTimeout time.Duration `json:"handshakeTimeout" yaml:"handshakeTimeout" toml:"handshakeTimeout"` + ReadBufferSize int `json:"readBufferSize" yaml:"readBufferSize" toml:"readBufferSize"` + WriteBufferSize int `json:"writeBufferSize" yaml:"writeBufferSize" toml:"writeBufferSize"` + EnableCompression bool `json:"enableCompression" yaml:"enableCompression" toml:"enableCompression"` +}