-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
320 additions
and
2,357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: v1 | ||
plugins: | ||
- name: gotag | ||
out: . | ||
opt: paths=source_relative,auto="form-as-snake" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: v1 | ||
plugins: | ||
- name: go | ||
out: . | ||
opt: paths=source_relative | ||
- name: go-grpc | ||
out: . | ||
opt: paths=source_relative | ||
- name: validate | ||
out: . | ||
opt: | ||
- lang=go | ||
- paths=source_relative |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Generated by buf. DO NOT EDIT. | ||
version: v1 | ||
deps: | ||
- remote: buf.build | ||
owner: envoyproxy | ||
repository: protoc-gen-validate | ||
commit: dc09a417d27241f7b069feae2cd74a0e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: v1 | ||
deps: | ||
- buf.build/envoyproxy/protoc-gen-validate | ||
breaking: | ||
use: | ||
- FILE | ||
lint: | ||
use: | ||
- DEFAULT |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,57 @@ | ||
syntax = "proto3"; | ||
|
||
package api.config.registry.v1; | ||
option go_package = "github.com/go-goim/api/config/registry/v1"; | ||
|
||
import "google/protobuf/duration.proto"; | ||
|
||
import "validate/validate.proto"; | ||
|
||
option go_package = "github.com/go-goim/api/config/registry/v1"; | ||
|
||
message RegistryInfo { | ||
repeated string addr = 1 [(validate.rules).repeated = { | ||
min_items: 1, | ||
unique: true, | ||
}]; | ||
string scheme = 2 [(validate.rules).string = {in: ["http", "grpc"]}]; | ||
// range [10ms, 10s] | ||
google.protobuf.Duration dial_timeout_sec = 3 [(validate.rules).duration = { | ||
gte: {nanos: 1000000, seconds: 0}, | ||
lte: {seconds: 10} | ||
}]; | ||
google.protobuf.Duration dial_keep_alive_time_sec = 4; | ||
google.protobuf.Duration dial_keep_alive_timeout_sec = 5; | ||
repeated string addr = 1 [(validate.rules).repeated = { | ||
min_items: 1, | ||
unique: true, | ||
}]; | ||
string scheme = 2 [(validate.rules).string = { | ||
in: [ | ||
"http", | ||
"grpc" | ||
] | ||
}]; | ||
// range [10ms, 10s] | ||
google.protobuf.Duration dial_timeout_sec = 3 [(validate.rules).duration = { | ||
gte: { | ||
nanos: 1000000, | ||
seconds: 0 | ||
}, | ||
lte: { | ||
seconds: 10 | ||
} | ||
}]; | ||
google.protobuf.Duration dial_keep_alive_time_sec = 4; | ||
google.protobuf.Duration dial_keep_alive_timeout_sec = 5; | ||
} | ||
|
||
message ConfigCenterInfo { | ||
// PathPrefix is prefix key of config center. | ||
string path_prefix = 1; | ||
// Paths is config paths of config center. | ||
repeated string paths = 2 [(validate.rules).repeated = {unique: true}]; | ||
// Format is config format of config center. | ||
string format = 3 [(validate.rules).string = {in: ["json", "yaml"]}]; | ||
// PathPrefix is prefix key of config center. | ||
string path_prefix = 1; | ||
// Paths is config paths of config center. | ||
repeated string paths = 2 [(validate.rules).repeated = { | ||
unique: true | ||
}]; | ||
// Format is config format of config center. | ||
string format = 3 [(validate.rules).string = { | ||
in: [ | ||
"json", | ||
"yaml" | ||
] | ||
}]; | ||
} | ||
|
||
message Registry { | ||
ConfigCenterInfo config_center = 1; | ||
oneof reg { | ||
RegistryInfo consul = 2; | ||
RegistryInfo etcd = 3; | ||
} | ||
ConfigCenterInfo config_center = 1; | ||
oneof reg { | ||
RegistryInfo consul = 2; | ||
RegistryInfo etcd = 3; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,137 @@ | ||
syntax = "proto3"; | ||
|
||
package api.config.v1; | ||
option go_package = "github.com/go-goim/api/config/v1"; | ||
|
||
import "google/protobuf/duration.proto"; | ||
|
||
import "validate/validate.proto"; | ||
|
||
option go_package = "github.com/go-goim/api/config/v1"; | ||
|
||
message Server { | ||
string scheme = 1 [(validate.rules).string = {in: ["http", "grpc", "tcp"]}]; | ||
int32 port = 2 [(validate.rules).int32 = {gt: 10000, lt: 60535}]; | ||
// range:[10ms, 10s] | ||
google.protobuf.Duration timeout = 3 [(validate.rules).duration = { | ||
gte: {nanos: 10000000, seconds: 0}, | ||
lte: {seconds: 10} | ||
}]; | ||
string scheme = 1 [(validate.rules).string = { | ||
in: [ | ||
"http", | ||
"grpc", | ||
"tcp" | ||
] | ||
}]; | ||
int32 port = 2 [(validate.rules).int32 = { | ||
gt: 10000, | ||
lt: 60535 | ||
}]; | ||
// range:[10ms, 10s] | ||
google.protobuf.Duration timeout = 3 [(validate.rules).duration = { | ||
gte: { | ||
nanos: 10000000, | ||
seconds: 0 | ||
}, | ||
lte: { | ||
seconds: 10 | ||
} | ||
}]; | ||
} | ||
|
||
message Service { | ||
// name has three parts: | ||
// 1. constant value: "goim" | ||
// 2. service type: ["service", "worker", "admin"] | ||
// 3. service name: any string | ||
// parts joined by "." | ||
// example: "goim.service.chat" | ||
string name = 1 [(validate.rules).string = {pattern: "^goim\\.(service|worker|admin)\\.[a-zA-Z0-9_]+$"}]; | ||
// version must match like "vx.y.z" | ||
string version = 2 [(validate.rules).string = {pattern: "^v[0-9]+\\.[0-9]+\\.[0-9]+$"}]; | ||
optional Server http = 3; | ||
optional Server grpc = 4; | ||
Log log = 5; | ||
map<string, string> metadata = 6; | ||
Redis redis = 7; | ||
MQ mq = 8; | ||
MySQL mysql = 9; | ||
// services name | ||
string gatewayService = 10; | ||
string userService = 11; | ||
string pushService = 12; | ||
string storeWorker = 13; | ||
string msgService = 14; | ||
string msgWorker = 15; | ||
// name has three parts: | ||
// 1. constant value: "goim" | ||
// 2. service type: ["service", "worker", "admin"] | ||
// 3. service name: any string | ||
// parts joined by "." | ||
// example: "goim.service.chat" | ||
string name = 1 [(validate.rules).string = { | ||
pattern: "^goim\\.(service|worker|admin)\\.[a-zA-Z0-9_]+$" | ||
}]; | ||
// version must match like "vx.y.z" | ||
string version = 2 [(validate.rules).string = { | ||
pattern: "^v[0-9]+\\.[0-9]+\\.[0-9]+$" | ||
}]; | ||
optional Server http = 3; | ||
optional Server grpc = 4; | ||
Log log = 5; | ||
map<string, string> metadata = 6; | ||
Redis redis = 7; | ||
MQ mq = 8; | ||
MySQL mysql = 9; | ||
// services name | ||
string gatewayService = 10; | ||
string userService = 11; | ||
string pushService = 12; | ||
string storeWorker = 13; | ||
string msgService = 14; | ||
string msgWorker = 15; | ||
} | ||
|
||
enum Level { | ||
DEBUG = 0; | ||
INFO = 1; | ||
WARNING = 2; | ||
ERROR = 3; | ||
FATAL = 4; | ||
DEBUG = 0; | ||
INFO = 1; | ||
WARNING = 2; | ||
ERROR = 3; | ||
FATAL = 4; | ||
} | ||
|
||
message Log { | ||
optional string log_path = 1; | ||
Level level = 2 [(validate.rules).enum.defined_only = true]; | ||
bool enable_console = 3; | ||
optional string log_path = 1; | ||
Level level = 2 [(validate.rules).enum.defined_only = true]; | ||
bool enable_console = 3; | ||
} | ||
|
||
message Redis { | ||
string addr = 1; | ||
string password = 2; | ||
int32 max_conns = 3; | ||
int32 min_idle_conns = 4; | ||
// range: [10ms,10s] | ||
google.protobuf.Duration dial_timeout = 5 [(validate.rules).duration = { | ||
gte: {nanos: 10000000, seconds: 0}, | ||
lte: {seconds: 10} | ||
}]; | ||
// range: [10ms,10s] | ||
google.protobuf.Duration idle_timeout = 6 [(validate.rules).duration = { | ||
gte: {nanos: 10000000, seconds: 0}, | ||
lte: {seconds: 10} | ||
}]; | ||
string addr = 1; | ||
string password = 2; | ||
int32 max_conns = 3; | ||
int32 min_idle_conns = 4; | ||
// range: [10ms,10s] | ||
google.protobuf.Duration dial_timeout = 5 [(validate.rules).duration = { | ||
gte: { | ||
nanos: 10000000, | ||
seconds: 0 | ||
}, | ||
lte: { | ||
seconds: 10 | ||
} | ||
}]; | ||
// range: [10ms,10s] | ||
google.protobuf.Duration idle_timeout = 6 [(validate.rules).duration = { | ||
gte: { | ||
nanos: 10000000, | ||
seconds: 0 | ||
}, | ||
lte: { | ||
seconds: 10 | ||
} | ||
}]; | ||
} | ||
|
||
message MQ { | ||
repeated string addr = 1; | ||
int32 max_retry = 2; | ||
repeated string addr = 1; | ||
int32 max_retry = 2; | ||
} | ||
|
||
message MySQL { | ||
string addr = 1; | ||
string user = 2; | ||
string password = 3; | ||
string db = 4; | ||
int32 max_idle_conns = 5; | ||
int32 max_open_conns = 6; | ||
// range: [10ms,10s] | ||
google.protobuf.Duration idle_timeout = 7 [(validate.rules).duration = { | ||
gte: {nanos: 1000000, seconds: 0}, | ||
lte: {seconds: 10} | ||
}]; | ||
// range: [10ms,10s] | ||
google.protobuf.Duration open_timeout = 8 [(validate.rules).duration = { | ||
gte: {nanos: 1000000, seconds: 0}, | ||
lte: {seconds: 10} | ||
}]; | ||
} | ||
string addr = 1; | ||
string user = 2; | ||
string password = 3; | ||
string db = 4; | ||
int32 max_idle_conns = 5; | ||
int32 max_open_conns = 6; | ||
// range: [10ms,10s] | ||
google.protobuf.Duration idle_timeout = 7 [(validate.rules).duration = { | ||
gte: { | ||
nanos: 1000000, | ||
seconds: 0 | ||
}, | ||
lte: { | ||
seconds: 10 | ||
} | ||
}]; | ||
// range: [10ms,10s] | ||
google.protobuf.Duration open_timeout = 8 [(validate.rules).duration = { | ||
gte: { | ||
nanos: 1000000, | ||
seconds: 0 | ||
}, | ||
lte: { | ||
seconds: 10 | ||
} | ||
}]; | ||
} |
Oops, something went wrong.