Compare commits

...

200 Commits

Author SHA1 Message Date
241146cb6f use meter directly
Some checks failed
codeql / analyze (go) (push) Failing after 1m55s
build / test (push) Failing after 2m8s
build / lint (push) Successful in 9m19s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-04-06 23:10:51 +03:00
3941a76333 cherry-pick
Some checks failed
build / test (push) Failing after 1m32s
codeql / analyze (go) (push) Failing after 1m56s
build / lint (push) Successful in 9m18s
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-03-07 23:25:45 +03:00
941bce3ee4 Merge pull request '#131 delete recover' (#173) from kgorbunov/micro-server-grpc:#131-v4 into master
Some checks failed
build / test (push) Failing after 5m21s
codeql / analyze (go) (push) Failing after 7m32s
build / lint (push) Successful in 10m48s
Reviewed-on: #173
2024-02-27 22:47:36 +03:00
Gorbunov Kirill Andreevich
da7980dbee #131 delete recover
Some checks failed
automerge / automerge (pull_request) Has been skipped
dependabot-automerge / automerge (pull_request) Has been skipped
autoapprove / autoapprove (pull_request) Successful in 17s
codeql / analyze (go) (pull_request) Has been cancelled
prbuild / test (pull_request) Has been cancelled
prbuild / lint (pull_request) Has been cancelled
2024-02-27 22:42:23 +03:00
00b616a35d dont log error in server
Some checks failed
build / test (push) Has been cancelled
build / lint (push) Has been cancelled
codeql / analyze (go) (push) Has been cancelled
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-02-19 02:12:16 +03:00
9907ff90f5 optimize unknown handler
Some checks failed
build / test (push) Has been cancelled
build / lint (push) Has been cancelled
codeql / analyze (go) (push) Has been cancelled
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-02-11 22:18:10 +03:00
4003d714ba Merge pull request 'add Path metadata' (#168) from metamaster into master
Some checks failed
build / test (push) Failing after 1m28s
build / lint (push) Failing after 2m33s
codeql / analyze (go) (push) Failing after 2m43s
Reviewed-on: #168
2023-11-03 19:30:47 +03:00
c23433a49c add Path metadata
Some checks failed
codeql / analyze (go) (pull_request) Failing after 2m50s
prbuild / test (pull_request) Failing after 1m29s
prbuild / lint (pull_request) Failing after 2m37s
autoapprove / autoapprove (pull_request) Failing after 1m25s
automerge / automerge (pull_request) Failing after 4s
dependabot-automerge / automerge (pull_request) Has been skipped
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-11-03 19:30:00 +03:00
fbb9e63df7 Merge branch 'v3'
Some checks failed
build / test (push) Failing after 7s
build / lint (push) Failing after 5s
codeql / analyze (go) (push) Failing after 5s
2023-06-12 18:31:41 +03:00
786bbb7185 Merge pull request 'dont init twice tls listener' (#167) from tls into v3
Reviewed-on: #167
2023-06-12 18:30:41 +03:00
95207c9617 dont init twice tls listener
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-06-12 18:29:07 +03:00
1213bace75 Merge pull request 'quic fix' (#166) from quicfix into v3
Reviewed-on: #166
2023-06-10 17:09:26 +03:00
3844d9484c quic fix
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-06-10 17:09:01 +03:00
b978e58cf9 Merge pull request 'add quic connection transport support' (#165) from quicv3 into v3
Reviewed-on: #165
2023-06-10 17:06:00 +03:00
a793983ed2 add quic connection transport support
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-06-10 17:05:34 +03:00
d646deb468 Merge pull request 'check subscribe errors' (#164) from subscribeerr into v3
Reviewed-on: #164
2023-05-13 16:06:53 +03:00
468819f0a0 check subscribe errors
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-05-13 16:06:37 +03:00
832f1034a8 Merge pull request 'combo prepare' (#162) from init-fix into v3
Reviewed-on: #162
2023-03-04 16:28:24 +03:00
f0b6370ee1 move codec registration to init phase
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-03-04 16:25:50 +03:00
3d522b094b
Merge pull request #162 from unistack-org/grpc-server
allow to expose *grpc.Server
2023-03-03 13:11:25 +03:00
92dcd1acd7 allow to expose *grpc.Server
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-03-03 13:08:06 +03:00
dc8a736e13
Merge pull request #161 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.14
Bump go.unistack.org/micro/v3 from 3.10.13 to 3.10.14
2023-02-27 11:11:04 +03:00
dependabot[bot]
4219919c9e
Bump go.unistack.org/micro/v3 from 3.10.13 to 3.10.14
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.13 to 3.10.14.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.13...v3.10.14)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-27 08:08:26 +00:00
1f447ea747
Merge pull request #160 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.13
Bump go.unistack.org/micro/v3 from 3.10.11 to 3.10.13
2023-02-22 10:20:56 +03:00
dependabot[bot]
30c0e01397
Bump go.unistack.org/micro/v3 from 3.10.11 to 3.10.13
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.11 to 3.10.13.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.11...v3.10.13)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-22 07:17:49 +00:00
244f3def4d
Merge pull request #158 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.11
Bump go.unistack.org/micro/v3 from 3.10.9 to 3.10.11
2023-02-14 11:02:57 +03:00
dependabot[bot]
55cbc89e11
Bump go.unistack.org/micro/v3 from 3.10.9 to 3.10.11
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.9 to 3.10.11.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.9...v3.10.11)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-14 08:00:11 +00:00
df00f718cf
Merge pull request #157 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.9
Bump go.unistack.org/micro/v3 from 3.10.8 to 3.10.9
2023-02-09 10:06:46 +03:00
dependabot[bot]
bc3369f3a6
Bump go.unistack.org/micro/v3 from 3.10.8 to 3.10.9
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.8 to 3.10.9.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.8...v3.10.9)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-09 07:04:05 +00:00
8d4c661ce5
Merge pull request #154 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.8
Bump go.unistack.org/micro/v3 from 3.10.5 to 3.10.8
2023-02-07 10:05:29 +03:00
dependabot[bot]
7b97212e26
Bump go.unistack.org/micro/v3 from 3.10.5 to 3.10.8
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.5 to 3.10.8.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.5...v3.10.8)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-07 07:02:56 +00:00
dependabot[bot]
9d5a2c1168
Bump golang.org/x/net from 0.4.0 to 0.5.0 (#148)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-31 06:57:46 +03:00
dependabot[bot]
483c6bb801
Bump google.golang.org/grpc from 1.52.0 to 1.52.3 (#152)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.52.0 to 1.52.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.52.0...v1.52.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-31 06:44:21 +03:00
dependabot[bot]
7ba5fd5fee
Bump golangci/golangci-lint-action from 3.3.1 to 3.4.0 (#149)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.3.1 to 3.4.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3.3.1...v3.4.0)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-30 21:13:46 +03:00
080705a5df
Merge pull request #153 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.5
Bump go.unistack.org/micro/v3 from 3.10.4 to 3.10.5
2023-01-30 10:09:18 +03:00
dependabot[bot]
79df512e5e
Bump go.unistack.org/micro/v3 from 3.10.4 to 3.10.5
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.4 to 3.10.5.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.4...v3.10.5)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-30 07:06:38 +00:00
dependabot[bot]
3e893b78c8
Bump dependabot/fetch-metadata from 1.3.5 to 1.3.6 (#150)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.5 to 1.3.6.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.5...v1.3.6)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-24 10:07:05 +03:00
8e9c64d78b
Merge pull request #147 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.4
Bump go.unistack.org/micro/v3 from 3.10.1 to 3.10.4
2023-01-18 10:06:07 +03:00
dependabot[bot]
d66aa424d2
Bump go.unistack.org/micro/v3 from 3.10.1 to 3.10.4
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.1 to 3.10.4.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.1...v3.10.4)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-18 07:03:33 +00:00
dependabot[bot]
f8d3695962
Bump google.golang.org/grpc from 1.51.0 to 1.52.0 (#144)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.51.0 to 1.52.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.51.0...v1.52.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-17 23:45:55 +03:00
ae158ce5fc
Merge pull request #146 from unistack-org/endpoint
fix endpoint
2023-01-17 23:45:33 +03:00
8125c9003c
Merge branch 'v3' into endpoint 2023-01-17 23:43:06 +03:00
a6f6df257b fix endpoint
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-01-17 23:41:48 +03:00
6b19cb2fb7
Merge pull request #145 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.1
Bump go.unistack.org/micro/v3 from 3.10.0 to 3.10.1
2023-01-17 10:05:22 +03:00
dependabot[bot]
db6fee9760
Bump go.unistack.org/micro/v3 from 3.10.0 to 3.10.1
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.10.0 to 3.10.1.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.10.0...v3.10.1)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-17 07:03:21 +00:00
309f100532
Merge pull request #143 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.10.0
Bump go.unistack.org/micro/v3 from 3.9.18 to 3.10.0
2023-01-09 10:07:40 +03:00
dependabot[bot]
22ae55f739
Bump go.unistack.org/micro/v3 from 3.9.18 to 3.10.0
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.18 to 3.10.0.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.18...v3.10.0)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-09 07:05:04 +00:00
70700a3f86
Merge pull request #142 from unistack-org/content-type
use default google grpc content-type
2023-01-07 23:30:18 +03:00
7dd327086c use default google grpc content-type
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2023-01-07 23:27:53 +03:00
a67efa39ae
Merge pull request #141 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.18
Bump go.unistack.org/micro/v3 from 3.9.17 to 3.9.18
2022-12-28 10:05:23 +03:00
dependabot[bot]
8ee91422cc
Bump go.unistack.org/micro/v3 from 3.9.17 to 3.9.18
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.17 to 3.9.18.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.17...v3.9.18)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-28 07:03:16 +00:00
f8ae500c5f
Merge pull request #140 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.17
Bump go.unistack.org/micro/v3 from 3.9.15 to 3.9.17
2022-12-26 10:12:06 +03:00
dependabot[bot]
7fcc042fbf
Bump go.unistack.org/micro/v3 from 3.9.15 to 3.9.17
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.15 to 3.9.17.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.15...v3.9.17)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 07:10:05 +00:00
3a22f3a900
Merge pull request #139 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.15
Bump go.unistack.org/micro/v3 from 3.9.14 to 3.9.15
2022-11-29 10:05:49 +03:00
dependabot[bot]
452a124aee
Bump go.unistack.org/micro/v3 from 3.9.14 to 3.9.15
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.14 to 3.9.15.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.14...v3.9.15)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 07:03:27 +00:00
dependabot[bot]
26d3adfe95
Bump google.golang.org/grpc from 1.50.1 to 1.51.0 (#137)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.50.1 to 1.51.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.50.1...v1.51.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-28 22:17:21 +03:00
dependabot[bot]
18d6584c8f
Bump hmarr/auto-approve-action from 2 to 3 (#136)
Bumps [hmarr/auto-approve-action](https://github.com/hmarr/auto-approve-action) from 2 to 3.
- [Release notes](https://github.com/hmarr/auto-approve-action/releases)
- [Commits](https://github.com/hmarr/auto-approve-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: hmarr/auto-approve-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-28 16:25:14 +03:00
f26dde5d63
Merge pull request #138 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.14
Bump go.unistack.org/micro/v3 from 3.9.13 to 3.9.14
2022-11-28 10:07:46 +03:00
dependabot[bot]
66d3feb263
Bump go.unistack.org/micro/v3 from 3.9.13 to 3.9.14
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.13 to 3.9.14.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.13...v3.9.14)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-28 07:05:07 +00:00
5c8effa23f
Merge pull request #135 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.13
Bump go.unistack.org/micro/v3 from 3.9.11 to 3.9.13
2022-11-15 10:04:29 +03:00
dependabot[bot]
c1e318d0b3
Bump go.unistack.org/micro/v3 from 3.9.11 to 3.9.13
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.11 to 3.9.13.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.11...v3.9.13)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-15 07:02:41 +00:00
617764706c
Merge pull request #134 from unistack-org/metadata
allow to send server metadata via header
2022-11-14 14:54:48 +03:00
0f3e56f697 allow to send server metadata via header
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-11-14 14:52:12 +03:00
dependabot[bot]
b87462c465
Bump golangci/golangci-lint-action from 3.3.0 to 3.3.1 (#133)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3.3.0...v3.3.1)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-14 13:43:38 +03:00
dependabot[bot]
e877a92718
Bump dependabot/fetch-metadata from 1.3.4 to 1.3.5 (#132)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.4 to 1.3.5.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.4...v1.3.5)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-14 06:51:08 +03:00
dependabot[bot]
c60f0ccb26
Bump golangci/golangci-lint-action from 3.2.0 to 3.3.0 (#129)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3.2.0...v3.3.0)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-02 20:16:36 +00:00
7cf4a8d293
Merge pull request #130 from unistack-org/panic_info
in case of panic, return full service handler name
2022-11-02 23:12:27 +03:00
84b1b862a7 in case of panic, return full service handler name
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-11-02 23:09:59 +03:00
dependabot[bot]
eb17921feb
Bump google.golang.org/grpc from 1.50.0 to 1.50.1 (#128)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.50.0 to 1.50.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.50.0...v1.50.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-19 22:51:09 +03:00
dependabot[bot]
ddeb0a23c3
Bump google.golang.org/grpc from 1.49.0 to 1.50.0 (#127)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.49.0 to 1.50.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.49.0...v1.50.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-11 11:51:09 +03:00
dependabot[bot]
830d8d8fda
Bump dependabot/fetch-metadata from 1.3.3 to 1.3.4 (#126)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.3 to 1.3.4.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.3...v1.3.4)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-04 13:05:48 +03:00
dependabot[bot]
ceaff6bf88
Bump google.golang.org/protobuf from 1.28.0 to 1.28.1 (#124)
Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.28.0 to 1.28.1.
- [Release notes](https://github.com/protocolbuffers/protobuf-go/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf-go/blob/master/release.bash)
- [Commits](https://github.com/protocolbuffers/protobuf-go/compare/v1.28.0...v1.28.1)

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-28 14:38:59 +00:00
dependabot[bot]
01848b8ec7
Bump dependabot/fetch-metadata from 1.3.1 to 1.3.3 (#121)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.1 to 1.3.3.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.1...v1.3.3)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-28 14:32:57 +00:00
dependabot[bot]
8ddfa39811
Bump google.golang.org/grpc from 1.47.0 to 1.49.0 (#125)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.47.0 to 1.49.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.47.0...v1.49.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-08-28 17:23:07 +03:00
110a8a8a9c
Merge pull request #122 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.11
Bump go.unistack.org/micro/v3 from 3.9.10 to 3.9.11
2022-07-12 10:29:59 +03:00
dependabot[bot]
f2587f0876
Bump go.unistack.org/micro/v3 from 3.9.10 to 3.9.11
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.10 to 3.9.11.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.10...v3.9.11)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-12 07:27:49 +00:00
eccdad9752
Merge pull request #119 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.10
Bump go.unistack.org/micro/v3 from 3.9.8 to 3.9.10
2022-06-27 10:28:13 +03:00
dependabot[bot]
c05996ee6e
Bump go.unistack.org/micro/v3 from 3.9.8 to 3.9.10
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.8 to 3.9.10.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.8...v3.9.10)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-27 07:25:51 +00:00
734d6fa7af
Merge pull request #118 from unistack-org/cleanup
update to latest micro
2022-06-27 00:42:27 +03:00
4c0ca3664a update to latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-06-27 00:39:51 +03:00
dependabot[bot]
d34ce4f314
Bump google.golang.org/grpc from 1.46.0 to 1.47.0 (#117)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.46.0 to 1.47.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.46.0...v1.47.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-25 23:32:07 +03:00
dependabot[bot]
d9932033ee
Bump golangci/golangci-lint-action from 3.1.0 to 3.2.0 (#115)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3.1.0...v3.2.0)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-11 11:28:34 +03:00
847887de84
Merge pull request #114 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.8
Bump go.unistack.org/micro/v3 from 3.9.7 to 3.9.8
2022-05-03 10:20:24 +03:00
dependabot[bot]
10ea1928f4
Bump go.unistack.org/micro/v3 from 3.9.7 to 3.9.8
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.7 to 3.9.8.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.7...v3.9.8)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-03 07:17:50 +00:00
dependabot[bot]
52d37c6579
Bump github/codeql-action from 1 to 2 (#113)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 1 to 2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v1...v2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-02 14:30:10 +03:00
dependabot[bot]
0af18ab84b
Bump google.golang.org/grpc from 1.45.0 to 1.46.0 (#112)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.45.0 to 1.46.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.45.0...v1.46.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-25 16:36:11 +03:00
dependabot[bot]
c46d11a2d4
Bump dependabot/fetch-metadata from 1.3.0 to 1.3.1 (#111)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-21 12:47:31 +03:00
dependabot[bot]
117f48aac5
Bump actions/setup-go from 2 to 3 (#109)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 3.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-04-11 23:03:50 +03:00
b4a2fbdeeb
Merge pull request #110 from unistack-org/init_fix
fix init
2022-04-11 16:19:36 +03:00
e36db68d4d fix init
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-04-11 16:17:02 +03:00
b6b101b140
Merge pull request #107 from unistack-org/status
allow to transfer *status.Status as error from handler
2022-04-06 18:44:20 +03:00
cbafc74e41 fux
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-04-06 18:41:43 +03:00
1e19359ab1 allow to transfer *status.Status as error from handler
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-04-06 18:38:38 +03:00
8e88abbbca allow to transfer *status.Status as error from handler
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-04-06 18:37:00 +03:00
adf9a0d82d
Merge pull request #106 from unistack-org/cleanup
cleanup
2022-04-03 14:48:09 +03:00
a1a5980534 cleanup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-04-03 14:45:40 +03:00
25a74b6935
Merge pull request #105 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.7
Bump go.unistack.org/micro/v3 from 3.9.5 to 3.9.7
2022-03-31 10:24:59 +03:00
dependabot[bot]
5ed755f5bb
Bump go.unistack.org/micro/v3 from 3.9.5 to 3.9.7
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.5 to 3.9.7.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.5...v3.9.7)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-31 07:22:43 +00:00
8dd303472d
Merge pull request #104 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.5
Bump go.unistack.org/micro/v3 from 3.9.1 to 3.9.5
2022-03-28 10:30:05 +03:00
dependabot[bot]
1f6b2b34ec
Bump go.unistack.org/micro/v3 from 3.9.1 to 3.9.5
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.1 to 3.9.5.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.1...v3.9.5)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 07:27:34 +00:00
ce3da2c9fa
Merge pull request #103 from unistack-org/wildcard
add unknown service handler
2022-03-24 14:40:38 +03:00
b248593e35 add unknown service handler
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-24 14:38:23 +03:00
dependabot[bot]
dda5d46e47
Bump google.golang.org/protobuf from 1.27.1 to 1.28.0 (#101)
Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.27.1 to 1.28.0.
- [Release notes](https://github.com/protocolbuffers/protobuf-go/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf-go/blob/master/release.bash)
- [Commits](https://github.com/protocolbuffers/protobuf-go/compare/v1.27.1...v1.28.0)

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-23 12:09:21 +03:00
0f50e30f9c
Merge pull request #102 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.9.1
Bump go.unistack.org/micro/v3 from 3.9.0 to 3.9.1
2022-03-23 10:30:33 +03:00
dependabot[bot]
f983ccc6d9
Bump go.unistack.org/micro/v3 from 3.9.0 to 3.9.1
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.9.0 to 3.9.1.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.9.0...v3.9.1)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-23 07:28:34 +00:00
dependabot[bot]
ef9ee6d837
Bump actions/cache from 2 to 3 (#100)
Bumps [actions/cache](https://github.com/actions/cache) from 2 to 3.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-22 23:04:53 +03:00
0103c05275
Merge pull request #99 from unistack-org/cleanup
server: remove unparsed body from request and message
2022-03-21 15:34:00 +03:00
d1c11644e8
Merge branch 'v3' into cleanup 2022-03-21 15:31:43 +03:00
dc01d20561 server: remove unparsed body from request and message
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-21 15:28:39 +03:00
cdee03a96e
Merge pull request #98 from unistack-org/grpc-fixes
support Grpc-Timeout header, export default content type
2022-03-21 13:06:19 +03:00
48bce4ed2f support Grpc-Timeout header, export default content type
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-21 13:03:48 +03:00
dependabot[bot]
f00e34380b
Bump google.golang.org/grpc from 1.44.0 to 1.45.0 (#97)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.44.0 to 1.45.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.44.0...v1.45.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-16 19:49:58 +03:00
86ebd173f7 update go version
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-07 13:46:36 +03:00
9923c98469 update workflows
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-03-05 19:09:59 +03:00
dependabot[bot]
51b93c413c
Bump dependabot/fetch-metadata from 1.1.1 to 1.2.1 (#93)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.1.1 to 1.2.1.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.1.1...v1.2.1)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-01 00:37:21 +03:00
dependabot[bot]
9617533481
Bump golangci/golangci-lint-action from 2 to 3 (#94)
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 2 to 3.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2022-02-25 13:29:24 +03:00
dependabot[bot]
71f7ea49e4
Bump go.unistack.org/micro/v3 from 3.8.20 to 3.8.21 (#91)
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.20 to 3.8.21.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.20...v3.8.21)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-25 13:24:52 +03:00
dependabot[bot]
8e89b4b32f
Bump google.golang.org/grpc from 1.43.0 to 1.44.0 (#90)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.43.0 to 1.44.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.43.0...v1.44.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-25 09:49:56 +03:00
9a2965b4d4
Merge pull request #89 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.20
Bump go.unistack.org/micro/v3 from 3.8.19 to 3.8.20
2022-01-26 10:21:14 +03:00
dependabot[bot]
d90ff34a67
Bump go.unistack.org/micro/v3 from 3.8.19 to 3.8.20
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.19 to 3.8.20.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.19...v3.8.20)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-26 07:19:11 +00:00
d2ef32f628
Merge pull request #88 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.19
Bump go.unistack.org/micro/v3 from 3.8.18 to 3.8.19
2022-01-25 10:24:14 +03:00
dependabot[bot]
d14209e31e
Bump go.unistack.org/micro/v3 from 3.8.18 to 3.8.19
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.18 to 3.8.19.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.18...v3.8.19)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-25 07:20:44 +00:00
d82f7c49c7
Merge pull request #87 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.18
Bump go.unistack.org/micro/v3 from 3.8.16 to 3.8.18
2022-01-24 10:21:34 +03:00
dependabot[bot]
98c02c72b0
Bump go.unistack.org/micro/v3 from 3.8.16 to 3.8.18
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.16 to 3.8.18.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.16...v3.8.18)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-24 07:18:13 +00:00
35ad59444a
Merge pull request #86 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.16
Bump go.unistack.org/micro/v3 from 3.8.15 to 3.8.16
2022-01-21 10:21:02 +03:00
dependabot[bot]
9e63562468
Bump go.unistack.org/micro/v3 from 3.8.15 to 3.8.16
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.15 to 3.8.16.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.15...v3.8.16)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-21 07:19:14 +00:00
978f500ce2
Merge pull request #85 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.15
Bump go.unistack.org/micro/v3 from 3.8.14 to 3.8.15
2022-01-20 10:18:30 +03:00
dependabot[bot]
8c8073ca01
Bump go.unistack.org/micro/v3 from 3.8.14 to 3.8.15
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.14 to 3.8.15.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.14...v3.8.15)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-20 07:16:33 +00:00
dependabot[bot]
8d283ce2b2
Bump google.golang.org/grpc from 1.42.0 to 1.43.0 (#81)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.42.0 to 1.43.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.42.0...v1.43.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-12 15:31:51 +03:00
d98376446a
Merge pull request #84 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.14
Bump go.unistack.org/micro/v3 from 3.8.11 to 3.8.14
2022-01-11 10:20:48 +03:00
dependabot[bot]
e95d956ff7
Bump go.unistack.org/micro/v3 from 3.8.11 to 3.8.14
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.11 to 3.8.14.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.11...v3.8.14)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-11 07:16:38 +00:00
dependabot[bot]
ad2dc43aed
Bump google.golang.org/grpc from 1.41.0 to 1.42.0 (#78)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.41.0 to 1.42.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.41.0...v1.42.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-24 14:51:05 +03:00
54562aa346
Merge pull request #80 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.11
Bump go.unistack.org/micro/v3 from 3.8.10 to 3.8.11
2021-11-24 10:20:56 +03:00
dependabot[bot]
6f202b3a97
Bump go.unistack.org/micro/v3 from 3.8.10 to 3.8.11
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.10 to 3.8.11.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.10...v3.8.11)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-24 07:18:28 +00:00
aa73377fb5
Merge pull request #79 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.10
Bump go.unistack.org/micro/v3 from 3.8.7 to 3.8.10
2021-11-19 10:20:38 +03:00
dependabot[bot]
6b1e5195ba
Bump go.unistack.org/micro/v3 from 3.8.7 to 3.8.10
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.7 to 3.8.10.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.7...v3.8.10)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-19 07:18:34 +00:00
cbbcb2c10a
Merge pull request #77 from unistack-org/dependabot/go_modules/go.unistack.org/micro/v3-3.8.7
Bump go.unistack.org/micro/v3 from 3.8.5 to 3.8.7
2021-10-28 11:24:58 +03:00
dependabot[bot]
7d7fc39779
Bump go.unistack.org/micro/v3 from 3.8.5 to 3.8.7
Bumps [go.unistack.org/micro/v3](https://github.com/unistack-org/micro) from 3.8.5 to 3.8.7.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.8.5...v3.8.7)

---
updated-dependencies:
- dependency-name: go.unistack.org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-28 07:17:30 +00:00
dependabot[bot]
483eda5adc
Bump google.golang.org/grpc from 1.40.0 to 1.41.0 (#73)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.40.0 to 1.41.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.40.0...v1.41.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 18:09:42 +03:00
25d47a5b01 update workflows
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 18:05:10 +03:00
0e1531f6a3 fix import guard
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 01:01:15 +03:00
ce9b97f24f update import paths
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-10-27 01:00:27 +03:00
82d14b4ea7 update for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-27 09:13:54 +03:00
5beb4bc7d9 update workflow
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-21 21:47:54 +03:00
dependabot[bot]
c42770b800
Bump github.com/unistack-org/micro/v3 from 3.7.0 to 3.7.1 (#69)
Bumps [github.com/unistack-org/micro/v3](https://github.com/unistack-org/micro) from 3.7.0 to 3.7.1.
- [Release notes](https://github.com/unistack-org/micro/releases)
- [Commits](https://github.com/unistack-org/micro/compare/v3.7.0...v3.7.1)

---
updated-dependencies:
- dependency-name: github.com/unistack-org/micro/v3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-17 08:29:38 +03:00
30c852913b update workflows
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-17 07:49:21 +03:00
97ee4eaa33 enable automerge
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-16 11:10:58 +03:00
dependabot[bot]
d77c36d479
Bump github.com/unistack-org/micro/v3 from 3.3.17 to 3.7.0 (#68) 2021-09-06 07:44:43 +00:00
dependabot[bot]
4696079471
Bump google.golang.org/protobuf from 1.26.0 to 1.27.1 (#67) 2021-09-06 07:41:26 +00:00
dependabot[bot]
bf3c302813
Bump google.golang.org/grpc from 1.37.1 to 1.40.0 (#66) 2021-09-06 07:38:12 +00:00
a36801b7ee replace renovate with dependabot
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-09-06 10:25:13 +03:00
3b81209099 use single err variable
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-06-17 14:12:26 +03:00
25abc921d5 remove stale funcs
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-06-15 23:23:42 +03:00
d3ef82346d fix default content type
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-05-24 23:13:21 +03:00
Renovate Bot
df72327b91 Update module google.golang.org/grpc to v1.37.1 2021-05-12 00:56:33 +00:00
Renovate Bot
68e3240e8e Update golang.org/x/net commit hash to 4163338 2021-05-10 13:59:54 +00:00
Renovate Bot
f1671c0150 Update golang.org/x/net commit hash to 16afe75 2021-05-08 08:08:02 +00:00
Renovate Bot
15cd1aaaa5 Update golang.org/x/net commit hash to 0714010 2021-05-06 00:55:58 +00:00
Renovate Bot
d9bae52513 Update golang.org/x/net commit hash to 0287a6f 2021-05-05 07:57:56 +00:00
Renovate Bot
a39577fb6a Update golang.org/x/net commit hash to bbd867f 2021-05-04 16:53:24 +00:00
Renovate Bot
f5a44c602c Update golang.org/x/net commit hash to 7fd8e65 2021-05-03 09:30:20 +00:00
Renovate Bot
676efbae2f Update golang.org/x/net commit hash to e590880 2021-05-02 05:06:13 +00:00
Renovate Bot
39b8b610d6 Update golang.org/x/net commit hash to f8dd838 2021-05-01 23:44:03 +00:00
Renovate Bot
4667c94f11 Update golang.org/x/net commit hash to aec3718 2021-05-01 15:52:50 +00:00
Renovate Bot
3d34b06e4f Update golang.org/x/net commit hash to 89ef3d9 2021-04-28 17:48:11 +00:00
Renovate Bot
0e859116bc Update golang.org/x/net commit hash to 85d9c07 2021-04-28 02:25:17 +00:00
1206fecf93 update for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-04-27 18:43:57 +03:00
e091caef5d stale
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-04-26 19:14:30 +03:00
d8508301cf
lint (#53)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-04-26 19:04:27 +03:00
Renovate Bot
03dd750f7c Update golang.org/x/net commit hash to 5f58ad6 2021-04-23 23:59:46 +00:00
Renovate Bot
5914e610a1 Update golang.org/x/net commit hash to 4e50805 2021-04-22 02:48:09 +00:00
Renovate Bot
48841609ba Update golang.org/x/net commit hash to 798c215 2021-04-21 00:52:41 +00:00
Renovate Bot
dfc0ac0ea8 Update golang.org/x/net commit hash to d25e304 2021-04-20 11:54:59 +00:00
d0bc3d0d3b update for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-04-20 12:55:27 +03:00
683eb62973 drop AuthTLS option and use server TLSConfig option
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-04-20 12:22:50 +03:00
Renovate Bot
b0cad975e4 Update module github.com/unistack-org/micro/v3 to v3.3.15 2021-04-19 16:27:21 +00:00
Renovate Bot
488d3995e7 Update module github.com/unistack-org/micro/v3 to v3.3.14 2021-04-19 03:35:58 +00:00
8eeab44898 minor content-type fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-04-16 17:04:47 +03:00
Renovate Bot
668e034041 Update golang.org/x/net commit hash to e915ea6 2021-04-16 01:56:20 +00:00
Renovate Bot
366afe2374 Update golang.org/x/net commit hash to 0645797 2021-04-14 23:31:52 +00:00
Renovate Bot
0812a98bf9 Update golang.org/x/net commit hash to afb366f 2021-04-10 10:16:03 +00:00
Renovate Bot
eab671950b Update module github.com/unistack-org/micro/v3 to v3.3.13 2021-04-10 01:53:05 +00:00
Renovate Bot
8409d351ea Update module github.com/unistack-org/micro/v3 to v3.3.12 2021-04-09 22:28:32 +00:00
Renovate Bot
c76406592c Update module google.golang.org/grpc to v1.37.0 2021-04-07 23:44:47 +00:00
Renovate Bot
d7b0517712 Update golang.org/x/net commit hash to a5a99cb 2021-04-05 20:06:57 +00:00
Renovate Bot
c2f50bce8f Update module github.com/unistack-org/micro/v3 to v3.3.11 2021-04-03 11:22:32 +00:00
Renovate Bot
476cb410f7 Update all deps 2021-04-01 00:05:10 +00:00
Renovate Bot
065f490a4d Update golang.org/x/net commit hash to cb1fcc7 2021-03-31 08:30:44 +00:00
Renovate Bot
ebadb2725f Update golang.org/x/net commit hash to e572328 2021-03-31 02:25:57 +00:00
Renovate Bot
92bd0ee0e5 Update golang.org/x/net commit hash to cd0ac97 2021-03-30 23:10:31 +00:00
Renovate Bot
aa5de41ce2 Update golang.org/x/net commit hash to c8897c2 2021-03-30 15:45:33 +00:00
Renovate Bot
9b6c5ab540 Update golang.org/x/net commit hash to 22f4162 2021-03-30 11:33:33 +00:00
Renovate Bot
138d6faba6 Update all deps 2021-03-30 04:55:03 +00:00
Renovate Bot
41fbaf40ea Update module github.com/unistack-org/micro/v3 to v3.3.8 2021-03-29 02:47:05 +00:00
Renovate Bot
55cf5a1087 Update module github.com/unistack-org/micro/v3 to v3.3.7 2021-03-28 19:25:01 +00:00
Renovate Bot
545b411d9e Update golang.org/x/net commit hash to 61e0566 2021-03-27 02:24:38 +00:00
Renovate Bot
837fdb4c6c Update all deps 2021-03-26 17:36:29 +00:00
Renovate Bot
1d031ac40b Update module google.golang.org/grpc to v1.36.1 2021-03-26 03:30:20 +00:00
Renovate Bot
0311bca40e Update module github.com/unistack-org/micro/v3 to v3.3.2 2021-03-25 14:34:13 +00:00
Renovate Bot
e805df017f Update all deps 2021-03-25 01:21:16 +00:00
28 changed files with 1031 additions and 647 deletions

19
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,19 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
# Maintain dependencies for Golang
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"

20
.github/renovate.json vendored
View File

@ -1,20 +0,0 @@
{
"extends": [
"config:base"
],
"postUpdateOptions": ["gomodTidy"],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
},
{
"groupName": "all deps",
"separateMajorMinor": true,
"groupSlug": "all",
"packagePatterns": [
"*"
]
}
]
}

13
.github/stale.sh vendored
View File

@ -1,13 +0,0 @@
#!/bin/bash -ex
export PATH=$PATH:$(pwd)/bin
export GO111MODULE=on
export GOBIN=$(pwd)/bin
#go get github.com/rvflash/goup@v0.4.1
#goup -v ./...
#go get github.com/psampaz/go-mod-outdated@v0.6.0
go list -u -m -mod=mod -json all | go-mod-outdated -update -direct -ci || true
#go list -u -m -json all | go-mod-outdated -update

20
.github/workflows/autoapprove.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: "autoapprove"
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]
permissions:
pull-requests: write
contents: write
jobs:
autoapprove:
runs-on: ubuntu-latest
steps:
- name: approve
uses: hmarr/auto-approve-action@v3
if: github.actor == 'vtolstov' || github.actor == 'dependabot[bot]'
id: approve
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

21
.github/workflows/automerge.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: "automerge"
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]
permissions:
pull-requests: write
contents: write
jobs:
automerge:
runs-on: ubuntu-latest
if: github.actor == 'vtolstov'
steps:
- name: merge
id: merge
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}

View File

@ -3,19 +3,20 @@ on:
push: push:
branches: branches:
- master - master
- v3
jobs: jobs:
test: test:
name: test name: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: setup - name: setup
uses: actions/setup-go@v2 uses: actions/setup-go@v3
with: with:
go-version: 1.16 go-version: 1.17
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: cache - name: cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ~/go/pkg/mod path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
@ -31,9 +32,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: lint - name: lint
uses: golangci/golangci-lint-action@v2 uses: golangci/golangci-lint-action@v3.4.0
continue-on-error: true continue-on-error: true
with: with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.

78
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,78 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "codeql"
on:
workflow_run:
workflows: ["prbuild"]
types:
- completed
push:
branches: [ master, v3 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, v3 ]
schedule:
- cron: '34 1 * * 0'
jobs:
analyze:
name: analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup
uses: actions/setup-go@v3
with:
go-version: 1.17
# Initializes the CodeQL tools for scanning.
- name: init
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: analyze
uses: github/codeql-action/analyze@v2

View File

@ -0,0 +1,27 @@
name: "dependabot-automerge"
on:
pull_request_target:
types: [assigned, opened, synchronize, reopened]
permissions:
pull-requests: write
contents: write
jobs:
automerge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: metadata
id: metadata
uses: dependabot/fetch-metadata@v1.3.6
with:
github-token: "${{ secrets.TOKEN }}"
- name: merge
id: merge
if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.TOKEN}}

View File

@ -3,19 +3,20 @@ on:
pull_request: pull_request:
branches: branches:
- master - master
- v3
jobs: jobs:
test: test:
name: test name: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: setup - name: setup
uses: actions/setup-go@v2 uses: actions/setup-go@v3
with: with:
go-version: 1.16 go-version: 1.17
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: cache - name: cache
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ~/go/pkg/mod path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
@ -31,9 +32,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: lint - name: lint
uses: golangci/golangci-lint-action@v2 uses: golangci/golangci-lint-action@v3.4.0
continue-on-error: true continue-on-error: true
with: with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
# General
.DS_Store
.idea
.vscode

44
.golangci.yml Normal file
View File

@ -0,0 +1,44 @@
run:
concurrency: 4
deadline: 5m
issues-exit-code: 1
tests: true
linters-settings:
govet:
check-shadowing: true
enable:
- fieldalignment
linters:
enable:
- govet
- deadcode
- errcheck
- govet
- ineffassign
- staticcheck
- structcheck
- typecheck
- unused
- varcheck
- bodyclose
- gci
- goconst
- gocritic
- gosimple
- gofmt
- gofumpt
- goimports
- golint
- gosec
- makezero
- misspell
- nakedret
- nestif
- nilerr
- noctx
- prealloc
- unconvert
- unparam
disable-all: false

View File

@ -3,25 +3,14 @@ package grpc
import ( import (
"io" "io"
"github.com/unistack-org/micro/v3/codec" "go.unistack.org/micro/v3/codec"
"google.golang.org/grpc"
"google.golang.org/grpc/encoding" "google.golang.org/grpc/encoding"
) )
type wrapStream struct{ grpc.ServerStream } var (
_ codec.Codec = &wrapGrpcCodec{}
func (w *wrapStream) Write(d []byte) (int, error) { _ encoding.Codec = &wrapMicroCodec{}
n := len(d) )
err := w.ServerStream.SendMsg(&codec.Frame{Data: d})
return n, err
}
func (w *wrapStream) Read(d []byte) (int, error) {
m := &codec.Frame{}
err := w.ServerStream.RecvMsg(m)
d = m.Data
return len(d), err
}
type wrapMicroCodec struct{ codec.Codec } type wrapMicroCodec struct{ codec.Codec }
@ -29,50 +18,54 @@ func (w *wrapMicroCodec) Name() string {
return w.Codec.String() return w.Codec.String()
} }
func (w *wrapMicroCodec) Marshal(v interface{}) ([]byte, error) {
return w.Codec.Marshal(v)
}
func (w *wrapMicroCodec) Unmarshal(d []byte, v interface{}) error {
return w.Codec.Unmarshal(d, v)
}
type wrapGrpcCodec struct{ encoding.Codec } type wrapGrpcCodec struct{ encoding.Codec }
func (w *wrapGrpcCodec) String() string { func (w *wrapGrpcCodec) String() string {
return w.Codec.Name() return w.Codec.Name()
} }
func (w *wrapGrpcCodec) Marshal(v interface{}) ([]byte, error) { func (w *wrapGrpcCodec) Marshal(v interface{}, opts ...codec.Option) ([]byte, error) {
switch m := v.(type) { if m, ok := v.(*codec.Frame); ok {
case *codec.Frame:
return m.Data, nil return m.Data, nil
} }
return w.Codec.Marshal(v) return w.Codec.Marshal(v)
} }
func (w wrapGrpcCodec) Unmarshal(d []byte, v interface{}) error { func (w *wrapGrpcCodec) Unmarshal(d []byte, v interface{}, opts ...codec.Option) error {
if d == nil || v == nil { if d == nil || v == nil {
return nil return nil
} }
switch m := v.(type) { if m, ok := v.(*codec.Frame); ok {
case *codec.Frame:
m.Data = d m.Data = d
return nil return nil
} }
return w.Codec.Unmarshal(d, v) return w.Codec.Unmarshal(d, v)
} }
func (g *wrapGrpcCodec) ReadHeader(conn io.Reader, m *codec.Message, mt codec.MessageType) error { func (w *wrapGrpcCodec) ReadHeader(conn io.Reader, m *codec.Message, mt codec.MessageType) error {
return nil return nil
} }
func (g *wrapGrpcCodec) ReadBody(conn io.Reader, v interface{}) error { func (w *wrapGrpcCodec) ReadBody(conn io.Reader, v interface{}) error {
// caller has requested a frame if m, ok := v.(*codec.Frame); ok {
switch m := v.(type) {
case *codec.Frame:
_, err := conn.Read(m.Data) _, err := conn.Read(m.Data)
return err return err
} }
return codec.ErrInvalidMessage return codec.ErrInvalidMessage
} }
func (g *wrapGrpcCodec) Write(conn io.Writer, m *codec.Message, v interface{}) error { func (w *wrapGrpcCodec) Write(conn io.Writer, m *codec.Message, v interface{}) error {
// if we don't have a body // if we don't have a body
if v != nil { if v != nil {
b, err := g.Marshal(v) b, err := w.Marshal(v)
if err != nil { if err != nil {
return err return err
} }

View File

@ -1,16 +0,0 @@
package grpc
import (
"context"
"github.com/unistack-org/micro/v3/server"
)
func setServerOption(k, v interface{}) server.Option {
return func(o *server.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, k, v)
}
}

View File

@ -6,25 +6,23 @@ import (
"net/http" "net/http"
"os" "os"
"github.com/unistack-org/micro/v3/errors" "go.unistack.org/micro/v3/errors"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
) )
var ( var errMapping = map[int32]codes.Code{
errMapping = map[int32]codes.Code{ http.StatusOK: codes.OK,
http.StatusOK: codes.OK, http.StatusBadRequest: codes.InvalidArgument,
http.StatusBadRequest: codes.InvalidArgument, http.StatusRequestTimeout: codes.DeadlineExceeded,
http.StatusRequestTimeout: codes.DeadlineExceeded, http.StatusNotFound: codes.NotFound,
http.StatusNotFound: codes.NotFound, http.StatusConflict: codes.AlreadyExists,
http.StatusConflict: codes.AlreadyExists, http.StatusForbidden: codes.PermissionDenied,
http.StatusForbidden: codes.PermissionDenied, http.StatusUnauthorized: codes.Unauthenticated,
http.StatusUnauthorized: codes.Unauthenticated, http.StatusPreconditionFailed: codes.FailedPrecondition,
http.StatusPreconditionFailed: codes.FailedPrecondition, http.StatusNotImplemented: codes.Unimplemented,
http.StatusNotImplemented: codes.Unimplemented, http.StatusInternalServerError: codes.Internal,
http.StatusInternalServerError: codes.Internal, http.StatusServiceUnavailable: codes.Unavailable,
http.StatusServiceUnavailable: codes.Unavailable, }
}
)
// convertCode converts a standard Go error into its canonical code. Note that // convertCode converts a standard Go error into its canonical code. Note that
// this is only used to translate the error returned by the server applications. // this is only used to translate the error returned by the server applications.
@ -60,8 +58,7 @@ func microError(err error) codes.Code {
} }
var ec int32 var ec int32
switch verr := err.(type) { if verr, ok := err.(*errors.Error); ok {
case *errors.Error:
ec = verr.Code ec = verr.Code
} }

32
go.mod
View File

@ -1,14 +1,28 @@
module github.com/unistack-org/micro-server-grpc/v3 module go.unistack.org/micro-server-grpc/v3
go 1.20
go 1.15
require ( require (
github.com/golang/protobuf v1.5.1 github.com/golang/protobuf v1.5.4
github.com/unistack-org/micro/v3 v3.3.0 github.com/quic-go/quic-go v0.41.0
golang.org/x/net v0.0.0-20210324051636-2c4c8ecb7826 go.unistack.org/micro/v3 v3.10.48
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect golang.org/x/net v0.22.0
google.golang.org/grpc v1.36.0 google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.26.0 google.golang.org/protobuf v1.33.0
) )
//replace github.com/unistack-org/micro/v3 => ../../micro require (
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 // indirect
github.com/onsi/ginkgo/v2 v2.16.0 // indirect
github.com/stretchr/testify v1.8.3 // indirect
go.uber.org/mock v0.4.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 // indirect
)

153
go.sum
View File

@ -1,108 +1,53 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/ef-ds/deque v1.0.4/go.mod h1:gXDnTC3yqvBcHbq2lcExjtAcVrOnJCbMcZXmuj8Z4tg= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 h1:y3N7Bm7Y9/CtpiVkw/ZWj6lSlDF3F74SfKwfTCer72Q=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/onsi/ginkgo/v2 v2.16.0 h1:7q1w9frJDzninhXxjZd+Y/x54XNjG/UlRLIYPZafsPM=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/onsi/ginkgo/v2 v2.16.0/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc=
github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/quic-go/quic-go v0.41.0 h1:aD8MmHfgqTURWNJy48IYFg2OnxwHT3JL7ahGs73lb4k=
github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= github.com/quic-go/quic-go v0.41.0/go.mod h1:qCkNjqczPEvgsOnxZ0eCD14lv+B2LHlFAB++CNOh9hA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/unistack-org/micro/v3 v3.3.0 h1:pEj/8QVFzMlNMEL//q/Te8qgG+XI6LTYIQrb6hMymgk= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/unistack-org/micro/v3 v3.3.0/go.mod h1:iJwCWq2PECMxigfqe6TPC5GLWvj6P94Kk+PTVZGL3w8= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= go.unistack.org/micro/v3 v3.10.48 h1:Ewht/3gNJNHcG7crQSuq5ys60tgVJYgtQ2oyymJspko=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= go.unistack.org/micro/v3 v3.10.48/go.mod h1:erMgt3Bl7vQQ0e9UpQyR5NlLiZ9pKeEJ9+1tfYFaqUg=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20210324051636-2c4c8ecb7826 h1:lNRDRnwZWawoPHDS50ebYHTOHjctRMLSrUSQFcAHiW4= golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.0.0-20210324051636-2c4c8ecb7826/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8 h1:IR+hp6ypxjH24bkMfEJ0yHR21+gwPWdV+/IBrPQyn3k=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005 h1:pDMpM2zh2MT0kHy037cKlSby2nEhD50SYqwQk76Nm40= google.golang.org/genproto/googleapis/rpc v0.0.0-20240304212257-790db918fca8/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.36.0 h1:o1bcQ6imQMIOpdrO3SWf2z5RV72WbDwdXuK0MDlc8As=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

640
grpc.go
View File

@ -1,5 +1,5 @@
// Package grpc provides a grpc server // Package grpc provides a grpc server
package grpc package grpc // import "go.unistack.org/micro-server-grpc/v3"
import ( import (
"context" "context"
@ -7,68 +7,63 @@ import (
"fmt" "fmt"
"net" "net"
"reflect" "reflect"
"runtime/debug"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"time" "time"
// nolint: staticcheck
oldproto "github.com/golang/protobuf/proto" oldproto "github.com/golang/protobuf/proto"
"github.com/unistack-org/micro/v3/broker" "go.unistack.org/micro/v3/broker"
"github.com/unistack-org/micro/v3/codec" "go.unistack.org/micro/v3/codec"
"github.com/unistack-org/micro/v3/errors" "go.unistack.org/micro/v3/errors"
"github.com/unistack-org/micro/v3/logger" "go.unistack.org/micro/v3/logger"
metadata "github.com/unistack-org/micro/v3/metadata" "go.unistack.org/micro/v3/metadata"
"github.com/unistack-org/micro/v3/register" "go.unistack.org/micro/v3/register"
"github.com/unistack-org/micro/v3/server" "go.unistack.org/micro/v3/semconv"
"go.unistack.org/micro/v3/server"
msync "go.unistack.org/micro/v3/sync"
"golang.org/x/net/netutil" "golang.org/x/net/netutil"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/encoding" "google.golang.org/grpc/encoding"
gmetadata "google.golang.org/grpc/metadata" gmetadata "google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer" "google.golang.org/grpc/peer"
grpcreflect "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )
const ( const (
defaultContentType = "application/grpc" DefaultContentType = "application/grpc"
) )
type grpcServerReflection struct { /*
type ServerReflection struct {
srv *grpc.Server srv *grpc.Server
s *serverReflectionServer s *serverReflectionServer
} }
*/
type grpcServer struct { type Server struct {
rpc *rServer handlers map[string]server.Handler
srv *grpc.Server srv *grpc.Server
exit chan chan error exit chan chan error
wg *sync.WaitGroup wg *msync.WaitGroup
rsvc *register.Service
subscribers map[*subscriber][]broker.Subscriber
rpc *rServer
opts server.Options
unknownHandler grpc.StreamHandler
sync.RWMutex sync.RWMutex
opts server.Options started bool
handlers map[string]server.Handler
subscribers map[*subscriber][]broker.Subscriber
init bool
// marks the serve as started
started bool
// used for first registration
registered bool registered bool
reflection bool reflection bool
// register service instance
rsvc *register.Service
codecs map[string]codec.Codec
} }
func newGRPCServer(opts ...server.Option) server.Server { func newServer(opts ...server.Option) *Server {
// create a grpc server // create a grpc server
g := &grpcServer{ g := &Server{
opts: server.NewOptions(opts...), opts: server.NewOptions(opts...),
rpc: &rServer{ rpc: &rServer{
serviceMap: make(map[string]*service), serviceMap: make(map[string]*service),
@ -97,7 +92,7 @@ func (r grpcRouter) ServeRequest(ctx context.Context, req server.Request, rsp se
*/ */
func (g *grpcServer) configure(opts ...server.Option) error { func (g *Server) configure(opts ...server.Option) error {
g.Lock() g.Lock()
defer g.Unlock() defer g.Unlock()
@ -114,9 +109,6 @@ func (g *grpcServer) configure(opts ...server.Option) error {
if err := g.opts.Tracer.Init(); err != nil { if err := g.opts.Tracer.Init(); err != nil {
return err return err
} }
if err := g.opts.Auth.Init(); err != nil {
return err
}
if err := g.opts.Logger.Init(); err != nil { if err := g.opts.Logger.Init(); err != nil {
return err return err
} }
@ -137,6 +129,10 @@ func (g *grpcServer) configure(opts ...server.Option) error {
} }
} }
for _, k := range g.opts.Codecs {
encoding.RegisterCodec(&wrapMicroCodec{k})
}
maxMsgSize := g.getMaxMsgSize() maxMsgSize := g.getMaxMsgSize()
gopts := []grpc.ServerOption{ gopts := []grpc.ServerOption{
@ -145,12 +141,8 @@ func (g *grpcServer) configure(opts ...server.Option) error {
grpc.UnknownServiceHandler(g.handler), grpc.UnknownServiceHandler(g.handler),
} }
if creds := g.getCredentials(); creds != nil {
gopts = append(gopts, grpc.Creds(creds))
}
if opts := g.getGrpcOptions(); opts != nil { if opts := g.getGrpcOptions(); opts != nil {
gopts = append(gopts, opts...) gopts = append(opts, gopts...)
} }
g.rsvc = nil g.rsvc = nil
@ -167,16 +159,18 @@ func (g *grpcServer) configure(opts ...server.Option) error {
g.reflection = v g.reflection = v
} }
if h, ok := g.opts.Context.Value(unknownServiceHandlerKey{}).(grpc.StreamHandler); ok {
g.unknownHandler = h
}
if restart { if restart {
return g.Start() return g.Start()
} }
g.init = true
return nil return nil
} }
func (g *grpcServer) getMaxMsgSize() int { func (g *Server) getMaxMsgSize() int {
if g.opts.Context == nil { if g.opts.Context == nil {
return codec.DefaultMaxMsgSize return codec.DefaultMaxMsgSize
} }
@ -187,16 +181,7 @@ func (g *grpcServer) getMaxMsgSize() int {
return s return s
} }
func (g *grpcServer) getCredentials() credentials.TransportCredentials { func (g *Server) getGrpcOptions() []grpc.ServerOption {
if g.opts.Context != nil {
if v, ok := g.opts.Context.Value(tlsAuth{}).(*tls.Config); ok && v != nil {
return credentials.NewTLS(v)
}
}
return nil
}
func (g *grpcServer) getGrpcOptions() []grpc.ServerOption {
if g.opts.Context == nil { if g.opts.Context == nil {
return nil return nil
} }
@ -209,42 +194,40 @@ func (g *grpcServer) getGrpcOptions() []grpc.ServerOption {
return opts return opts
} }
func (g *grpcServer) handler(srv interface{}, stream grpc.ServerStream) (err error) { func (g *Server) handler(srv interface{}, stream grpc.ServerStream) error {
defer func() { var err error
if r := recover(); r != nil {
g.RLock()
config := g.opts
g.RUnlock()
if config.Logger.V(logger.ErrorLevel) {
config.Logger.Error(config.Context, "panic recovered: ", r)
config.Logger.Error(config.Context, string(debug.Stack()))
}
err = errors.InternalServerError(g.opts.Name, "panic recovered: %v", r)
} else if err != nil {
g.RLock()
config := g.opts
g.RUnlock()
if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "grpc handler got error: %s", err)
}
}
}()
if g.wg != nil {
g.wg.Add(1)
defer g.wg.Done()
}
fullMethod, ok := grpc.MethodFromServerStream(stream) fullMethod, ok := grpc.MethodFromServerStream(stream)
if !ok { if !ok {
return status.Errorf(codes.Internal, "method does not exist in context") return status.Errorf(codes.Internal, "method does not exist in context")
} }
ts := time.Now()
g.opts.Meter.Counter(semconv.ServerRequestInflight, "endpoint", fullMethod).Inc()
defer func() {
te := time.Since(ts)
g.opts.Meter.Summary(semconv.ServerRequestLatencyMicroseconds, "endpoint", fullMethod).Update(te.Seconds())
g.opts.Meter.Histogram(semconv.ServerRequestDurationSeconds, "endpoint", fullMethod).Update(te.Seconds())
g.opts.Meter.Counter(semconv.ServerRequestInflight, "endpoint", fullMethod).Dec()
st := status.Convert(err)
if st == nil || st.Code() == codes.OK {
g.opts.Meter.Counter(semconv.ServerRequestTotal, "endpoint", fullMethod, "status", "success", "code", strconv.Itoa(int(codes.OK))).Inc()
} else {
g.opts.Meter.Counter(semconv.ServerRequestTotal, "endpoint", fullMethod, "status", "failure", "code", strconv.Itoa(int(st.Code()))).Inc()
}
}()
serviceName, methodName, err := serviceMethod(fullMethod) serviceName, methodName, err := serviceMethod(fullMethod)
if err != nil { if err != nil {
return status.New(codes.InvalidArgument, err.Error()).Err() return status.New(codes.InvalidArgument, err.Error()).Err()
} }
if g.wg != nil {
g.wg.Add(1)
defer g.wg.Done()
}
// get grpc metadata // get grpc metadata
gmd, ok := gmetadata.FromIncomingContext(stream.Context()) gmd, ok := gmetadata.FromIncomingContext(stream.Context())
if !ok { if !ok {
@ -255,15 +238,35 @@ func (g *grpcServer) handler(srv interface{}, stream grpc.ServerStream) (err err
for k, v := range gmd { for k, v := range gmd {
md.Set(k, strings.Join(v, ", ")) md.Set(k, strings.Join(v, ", "))
} }
md.Set("Path", fullMethod)
var td string
// timeout for server deadline // timeout for server deadline
to, ok := md.Get("timeout") if v, ok := md.Get("timeout"); ok {
if ok { md.Del("timeout")
md.Del("x-content-type") td = v
}
if v, ok := md.Get("Grpc-Timeout"); ok {
md.Del("Grpc-Timeout")
td = v[:len(v)-1]
switch v[len(v)-1:] {
case "S":
td += "s"
case "M":
td += "m"
case "H":
td += "h"
case "m":
td += "ms"
case "u":
td += "us"
case "n":
td += "ns"
}
} }
// get content type // get content type
ct := defaultContentType ct := DefaultContentType
if ctype, ok := md.Get("content-type"); ok { if ctype, ok := md.Get("content-type"); ok {
ct = ctype ct = ctype
@ -277,13 +280,13 @@ func (g *grpcServer) handler(srv interface{}, stream grpc.ServerStream) (err err
// get peer from context // get peer from context
if p, ok := peer.FromContext(stream.Context()); ok { if p, ok := peer.FromContext(stream.Context()); ok {
md["Remote"] = p.Addr.String() md.Set("Remote", p.Addr.String())
ctx = peer.NewContext(ctx, p) ctx = peer.NewContext(ctx, p)
} }
// set the timeout if we have it // set the timeout if we have it
if len(to) > 0 { if len(td) > 0 {
if n, err := strconv.ParseUint(to, 10, 64); err == nil { if n, err := strconv.ParseUint(td, 10, 64); err == nil {
var cancel context.CancelFunc var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, time.Duration(n)) ctx, cancel = context.WithTimeout(ctx, time.Duration(n))
defer cancel() defer cancel()
@ -294,197 +297,163 @@ func (g *grpcServer) handler(srv interface{}, stream grpc.ServerStream) (err err
svc := g.rpc.serviceMap[serviceName] svc := g.rpc.serviceMap[serviceName]
g.rpc.mu.RUnlock() g.rpc.mu.RUnlock()
if svc == nil && g.reflection && methodName == "ServerReflectionInfo" { /*
rfl := &grpcServerReflection{srv: g.srv, s: &serverReflectionServer{s: g.srv}} if svc == nil && g.reflection && methodName == "ServerReflectionInfo" {
svc = &service{} rfl := &ServerReflection{srv: g.srv, s: &serverReflectionServer{s: g.srv}}
svc.typ = reflect.TypeOf(rfl) svc = &service{}
svc.rcvr = reflect.ValueOf(rfl) svc.typ = reflect.TypeOf(rfl)
svc.name = reflect.Indirect(svc.rcvr).Type().Name() svc.rcvr = reflect.ValueOf(rfl)
svc.method = make(map[string]*methodType) svc.name = reflect.Indirect(svc.rcvr).Type().Name()
typ := reflect.TypeOf(rfl) svc.method = make(map[string]*methodType)
if me, ok := typ.MethodByName("ServerReflectionInfo"); ok { typ := reflect.TypeOf(rfl)
g.rpc.mu.Lock() if me, ok := typ.MethodByName("ServerReflectionInfo"); ok {
ep, err := prepareEndpoint(me) g.rpc.mu.Lock()
if ep != nil && err != nil { ep, err := prepareEndpoint(me)
svc.method["ServerReflectionInfo"] = ep if ep != nil && err != nil {
} else if err != nil { svc.method["ServerReflectionInfo"] = ep
return status.New(codes.Unimplemented, err.Error()).Err() } else if err != nil {
return status.New(codes.Unimplemented, err.Error()).Err()
}
g.rpc.mu.Unlock()
} }
g.rpc.mu.Unlock()
} }
} */
if svc == nil { if svc == nil {
if g.unknownHandler != nil {
return g.unknownHandler(srv, stream)
}
return status.New(codes.Unimplemented, fmt.Sprintf("unknown service %s", serviceName)).Err() return status.New(codes.Unimplemented, fmt.Sprintf("unknown service %s", serviceName)).Err()
} }
mtype := svc.method[methodName] mtype := svc.method[methodName]
if mtype == nil { if mtype == nil {
return status.New(codes.Unimplemented, fmt.Sprintf("unknown service %s.%s", serviceName, methodName)).Err() if g.unknownHandler != nil {
return g.unknownHandler(srv, stream)
}
return status.New(codes.Unimplemented, fmt.Sprintf("unknown service method %s.%s", serviceName, methodName)).Err()
} }
// process unary // process unary
if !mtype.stream { if !mtype.stream {
return g.processRequest(stream, svc, mtype, ct, ctx) return g.processRequest(ctx, stream, svc, mtype, ct)
} }
// process stream // process stream
return g.processStream(stream, svc, mtype, ct, ctx) return g.processStream(ctx, stream, svc, mtype, ct)
} }
func (g *grpcServer) processRequest(stream grpc.ServerStream, service *service, mtype *methodType, ct string, ctx context.Context) error { func (g *Server) processRequest(ctx context.Context, stream grpc.ServerStream, service *service, mtype *methodType, ct string) error {
for { // for {
var argv, replyv reflect.Value var err error
var argv, replyv reflect.Value
// Decode the argument value. // Decode the argument value.
argIsValue := false // if true, need to indirect before calling. argIsValue := false // if true, need to indirect before calling.
if mtype.ArgType.Kind() == reflect.Ptr { if mtype.ArgType.Kind() == reflect.Ptr {
argv = reflect.New(mtype.ArgType.Elem()) argv = reflect.New(mtype.ArgType.Elem())
} else { } else {
argv = reflect.New(mtype.ArgType) argv = reflect.New(mtype.ArgType)
argIsValue = true argIsValue = true
}
// Unmarshal request
if err := stream.RecvMsg(argv.Interface()); err != nil {
return err
}
if argIsValue {
argv = argv.Elem()
}
// reply value
replyv = reflect.New(mtype.ReplyType.Elem())
function := mtype.method.Func
var returnValues []reflect.Value
cf, err := g.newCodec(ct)
if err != nil {
return errors.InternalServerError(g.opts.Name, err.Error())
}
b, err := cf.Marshal(argv.Interface())
if err != nil {
return err
}
// create a client.Request
r := &rpcRequest{
service: g.opts.Name,
contentType: ct,
method: fmt.Sprintf("%s.%s", service.name, mtype.method.Name),
body: b,
payload: argv.Interface(),
}
// define the handler func
fn := func(ctx context.Context, req server.Request, rsp interface{}) (err error) {
returnValues = function.Call([]reflect.Value{service.rcvr, mtype.prepareContext(ctx), reflect.ValueOf(argv.Interface()), reflect.ValueOf(rsp)})
// The return value for the method is an error.
if rerr := returnValues[0].Interface(); rerr != nil {
err = rerr.(error)
}
return err
}
// wrap the handler func
for i := len(g.opts.HdlrWrappers); i > 0; i-- {
fn = g.opts.HdlrWrappers[i-1](fn)
}
statusCode := codes.OK
statusDesc := ""
// execute the handler
if appErr := fn(ctx, r, replyv.Interface()); appErr != nil {
var errStatus *status.Status
switch verr := appErr.(type) {
case *errors.Error:
statusCode = microError(verr)
statusDesc = verr.Error()
errStatus = status.New(statusCode, statusDesc)
case proto.Message:
// user defined error that proto based we can attach it to grpc status
statusCode = convertCode(appErr)
statusDesc = appErr.Error()
errStatus, err = status.New(statusCode, statusDesc).WithDetails(oldproto.MessageV1(verr))
if err != nil {
return err
}
default:
g.RLock()
config := g.opts
g.RUnlock()
if config.Logger.V(logger.ErrorLevel) {
config.Logger.Warn(config.Context, "handler error will not be transferred properly, must return *errors.Error or proto.Message")
}
// default case user pass own error type that not proto based
statusCode = convertCode(verr)
statusDesc = verr.Error()
errStatus = status.New(statusCode, statusDesc)
}
return errStatus.Err()
}
if err := stream.SendMsg(replyv.Interface()); err != nil {
return err
}
return status.New(statusCode, statusDesc).Err()
} }
// Unmarshal request
if err = stream.RecvMsg(argv.Interface()); err != nil {
return err
}
if argIsValue {
argv = argv.Elem()
}
// reply value
replyv = reflect.New(mtype.ReplyType.Elem())
function := mtype.method.Func
var returnValues []reflect.Value
// create a client.Request
r := &rpcRequest{
service: g.opts.Name,
contentType: ct,
method: fmt.Sprintf("%s.%s", service.name, mtype.method.Name),
endpoint: fmt.Sprintf("%s.%s", service.name, mtype.method.Name),
payload: argv.Interface(),
}
// define the handler func
fn := func(ctx context.Context, req server.Request, rsp interface{}) (err error) {
returnValues = function.Call([]reflect.Value{service.rcvr, mtype.prepareContext(ctx), argv, reflect.ValueOf(rsp)})
// The return value for the method is an error.
if rerr := returnValues[0].Interface(); rerr != nil {
err = rerr.(error)
}
return err
}
// wrap the handler func
for i := len(g.opts.HdlrWrappers); i > 0; i-- {
fn = g.opts.HdlrWrappers[i-1](fn)
}
statusCode := codes.OK
statusDesc := ""
// execute the handler
appErr := fn(ctx, r, replyv.Interface())
if outmd, ok := metadata.FromOutgoingContext(ctx); ok {
if err = stream.SendHeader(gmetadata.New(outmd)); err != nil {
return err
}
}
if appErr != nil {
var errStatus *status.Status
switch verr := appErr.(type) {
case *errors.Error:
statusCode = microError(verr)
statusDesc = verr.Error()
errStatus = status.New(statusCode, statusDesc)
case proto.Message:
// user defined error that proto based we can attach it to grpc status
statusCode = convertCode(appErr)
statusDesc = appErr.Error()
errStatus, err = status.New(statusCode, statusDesc).WithDetails(oldproto.MessageV1(verr))
if err != nil {
return err
}
case (interface{ GRPCStatus() *status.Status }):
errStatus = verr.GRPCStatus()
default:
g.RLock()
config := g.opts
g.RUnlock()
if config.Logger.V(logger.ErrorLevel) {
config.Logger.Warn(config.Context, "handler error will not be transferred properly, must return *errors.Error or proto.Message")
}
// default case user pass own error type that not proto based
statusCode = convertCode(verr)
statusDesc = verr.Error()
errStatus = status.New(statusCode, statusDesc)
}
return errStatus.Err()
}
if err := stream.SendMsg(replyv.Interface()); err != nil {
return err
}
return status.New(statusCode, statusDesc).Err()
} }
type reflectStream struct { func (g *Server) processStream(ctx context.Context, stream grpc.ServerStream, service *service, mtype *methodType, ct string) error {
stream server.Stream
}
func (s *reflectStream) Send(rsp *grpcreflect.ServerReflectionResponse) error {
return s.stream.Send(rsp)
}
func (s *reflectStream) Recv() (*grpcreflect.ServerReflectionRequest, error) {
req := &grpcreflect.ServerReflectionRequest{}
err := s.stream.Recv(req)
return req, err
}
func (s *reflectStream) SetHeader(gmetadata.MD) error {
return nil
}
func (s *reflectStream) SendHeader(gmetadata.MD) error {
return nil
}
func (s *reflectStream) SetTrailer(gmetadata.MD) {
}
func (s *reflectStream) Context() context.Context {
return s.stream.Context()
}
func (s *reflectStream) SendMsg(m interface{}) error {
return s.stream.Send(m)
}
func (s *reflectStream) RecvMsg(m interface{}) error {
return s.stream.Recv(m)
}
func (g *grpcServerReflection) ServerReflectionInfo(ctx context.Context, stream server.Stream) error {
return g.s.ServerReflectionInfo(&reflectStream{stream})
}
func (g *grpcServer) processStream(stream grpc.ServerStream, service *service, mtype *methodType, ct string, ctx context.Context) error {
opts := g.opts opts := g.opts
r := &rpcRequest{ r := &rpcRequest{
service: opts.Name, service: opts.Name,
contentType: ct, contentType: ct,
method: fmt.Sprintf("%s.%s", service.name, mtype.method.Name), method: fmt.Sprintf("%s.%s", service.name, mtype.method.Name),
endpoint: fmt.Sprintf("%s.%s", service.name, mtype.method.Name),
stream: true, stream: true,
} }
@ -513,7 +482,13 @@ func (g *grpcServer) processStream(stream grpc.ServerStream, service *service, m
statusCode := codes.OK statusCode := codes.OK
statusDesc := "" statusDesc := ""
if appErr := fn(ctx, r, ss); appErr != nil { appErr := fn(ctx, r, ss)
if outmd, ok := metadata.FromOutgoingContext(ctx); ok {
if err := stream.SendHeader(gmetadata.New(outmd)); err != nil {
return err
}
}
if appErr != nil {
var err error var err error
var errStatus *status.Status var errStatus *status.Status
switch verr := appErr.(type) { switch verr := appErr.(type) {
@ -545,10 +520,14 @@ func (g *grpcServer) processStream(stream grpc.ServerStream, service *service, m
return status.New(statusCode, statusDesc).Err() return status.New(statusCode, statusDesc).Err()
} }
func (g *grpcServer) newCodec(ct string) (codec.Codec, error) { func (g *Server) newCodec(ct string) (codec.Codec, error) {
g.RLock() g.RLock()
defer g.RUnlock() defer g.RUnlock()
if idx := strings.IndexRune(ct, ';'); idx >= 0 {
ct = ct[:idx]
}
if c, ok := g.opts.Codecs[ct]; ok { if c, ok := g.opts.Codecs[ct]; ok {
return c, nil return c, nil
} }
@ -556,7 +535,7 @@ func (g *grpcServer) newCodec(ct string) (codec.Codec, error) {
return nil, codec.ErrUnknownContentType return nil, codec.ErrUnknownContentType
} }
func (g *grpcServer) Options() server.Options { func (g *Server) Options() server.Options {
g.RLock() g.RLock()
opts := g.opts opts := g.opts
g.RUnlock() g.RUnlock()
@ -564,18 +543,15 @@ func (g *grpcServer) Options() server.Options {
return opts return opts
} }
func (g *grpcServer) Init(opts ...server.Option) error { func (g *Server) Init(opts ...server.Option) error {
if len(opts) == 0 && g.init {
return nil
}
return g.configure(opts...) return g.configure(opts...)
} }
func (g *grpcServer) NewHandler(h interface{}, opts ...server.HandlerOption) server.Handler { func (g *Server) NewHandler(h interface{}, opts ...server.HandlerOption) server.Handler {
return newRpcHandler(h, opts...) return newRPCHandler(h, opts...)
} }
func (g *grpcServer) Handle(h server.Handler) error { func (g *Server) Handle(h server.Handler) error {
if err := g.rpc.register(h.Handler()); err != nil { if err := g.rpc.register(h.Handler()); err != nil {
return err return err
} }
@ -584,11 +560,11 @@ func (g *grpcServer) Handle(h server.Handler) error {
return nil return nil
} }
func (g *grpcServer) NewSubscriber(topic string, sb interface{}, opts ...server.SubscriberOption) server.Subscriber { func (g *Server) NewSubscriber(topic string, sb interface{}, opts ...server.SubscriberOption) server.Subscriber {
return newSubscriber(topic, sb, opts...) return newSubscriber(topic, sb, opts...)
} }
func (g *grpcServer) Subscribe(sb server.Subscriber) error { func (g *Server) Subscribe(sb server.Subscriber) error {
sub, ok := sb.(*subscriber) sub, ok := sb.(*subscriber)
if !ok { if !ok {
return fmt.Errorf("invalid subscriber: expected *subscriber") return fmt.Errorf("invalid subscriber: expected *subscriber")
@ -612,7 +588,7 @@ func (g *grpcServer) Subscribe(sb server.Subscriber) error {
return nil return nil
} }
func (g *grpcServer) Register() error { func (g *Server) Register() error {
g.RLock() g.RLock()
rsvc := g.rsvc rsvc := g.rsvc
config := g.opts config := g.opts
@ -633,22 +609,18 @@ func (g *grpcServer) Register() error {
g.RLock() g.RLock()
// Maps are ordered randomly, sort the keys for consistency // Maps are ordered randomly, sort the keys for consistency
var handlerList []string handlerList := make([]string, 0, len(g.handlers))
for n, e := range g.handlers { for n := range g.handlers {
// Only advertise non internal handlers // Only advertise non internal handlers
if !e.Options().Internal { handlerList = append(handlerList, n)
handlerList = append(handlerList, n)
}
} }
sort.Strings(handlerList) sort.Strings(handlerList)
var subscriberList []*subscriber subscriberList := make([]*subscriber, 0, len(g.subscribers))
for e := range g.subscribers { for e := range g.subscribers {
// Only advertise non internal subscribers // Only advertise non internal subscribers
if !e.Options().Internal { subscriberList = append(subscriberList, e)
subscriberList = append(subscriberList, e)
}
} }
sort.Slice(subscriberList, func(i, j int) bool { sort.Slice(subscriberList, func(i, j int) bool {
return subscriberList[i].topic > subscriberList[j].topic return subscriberList[i].topic > subscriberList[j].topic
@ -664,7 +636,7 @@ func (g *grpcServer) Register() error {
g.RUnlock() g.RUnlock()
service.Nodes[0].Metadata["protocol"] = "grpc" service.Nodes[0].Metadata["protocol"] = "grpc"
service.Nodes[0].Metadata["transport"] = "grpc" service.Nodes[0].Metadata["transport"] = service.Nodes[0].Metadata["protocol"]
service.Endpoints = endpoints service.Endpoints = endpoints
g.RLock() g.RLock()
@ -673,7 +645,7 @@ func (g *grpcServer) Register() error {
if !registered { if !registered {
if config.Logger.V(logger.InfoLevel) { if config.Logger.V(logger.InfoLevel) {
config.Logger.Infof(config.Context, "Register [%s] Registering node: %s", config.Register.String(), service.Nodes[0].Id) config.Logger.Infof(config.Context, "Register [%s] Registering node: %s", config.Register.String(), service.Nodes[0].ID)
} }
} }
@ -690,37 +662,13 @@ func (g *grpcServer) Register() error {
g.Lock() g.Lock()
defer g.Unlock() defer g.Unlock()
for sb := range g.subscribers {
handler := g.createSubHandler(sb, config)
var opts []broker.SubscribeOption
if queue := sb.Options().Queue; len(queue) > 0 {
opts = append(opts, broker.SubscribeGroup(queue))
}
subCtx := config.Context
if cx := sb.Options().Context; cx != nil {
subCtx = cx
}
opts = append(opts, broker.SubscribeContext(subCtx))
opts = append(opts, broker.SubscribeAutoAck(sb.Options().AutoAck))
if config.Logger.V(logger.InfoLevel) {
config.Logger.Infof(config.Context, "Subscribing to topic: %s", sb.Topic())
}
sub, err := config.Broker.Subscribe(subCtx, sb.Topic(), handler, opts...)
if err != nil {
return err
}
g.subscribers[sb] = []broker.Subscriber{sub}
}
g.registered = true g.registered = true
g.rsvc = service g.rsvc = service
return nil return nil
} }
func (g *grpcServer) Deregister() error { func (g *Server) Deregister() error {
var err error var err error
g.RLock() g.RLock()
@ -733,7 +681,7 @@ func (g *grpcServer) Deregister() error {
} }
if config.Logger.V(logger.InfoLevel) { if config.Logger.V(logger.InfoLevel) {
config.Logger.Infof(config.Context, "Deregistering node: %s", service.Nodes[0].Id) config.Logger.Infof(config.Context, "Deregistering node: %s", service.Nodes[0].ID)
} }
if err := server.DefaultDeregisterFunc(service, config); err != nil { if err := server.DefaultDeregisterFunc(service, config); err != nil {
@ -774,7 +722,7 @@ func (g *grpcServer) Deregister() error {
return nil return nil
} }
func (g *grpcServer) Start() error { func (g *Server) Start() error {
g.RLock() g.RLock()
if g.started { if g.started {
g.RUnlock() g.RUnlock()
@ -784,18 +732,13 @@ func (g *grpcServer) Start() error {
config := g.Options() config := g.Options()
for _, k := range config.Codecs {
encoding.RegisterCodec(&wrapMicroCodec{k})
}
// micro: config.Transport.Listen(config.Address) // micro: config.Transport.Listen(config.Address)
var ts net.Listener var ts net.Listener
var err error
if l := config.Listener; l != nil { if l := config.Listener; l != nil {
ts = l ts = l
} else { } else {
var err error
// check the tls config for secure connect // check the tls config for secure connect
if tc := config.TLSConfig; tc != nil { if tc := config.TLSConfig; tc != nil {
ts, err = tls.Listen("tcp", config.Address, tc) ts, err = tls.Listen("tcp", config.Address, tc)
@ -825,7 +768,7 @@ func (g *grpcServer) Start() error {
// only connect if we're subscribed // only connect if we're subscribed
if len(g.subscribers) > 0 { if len(g.subscribers) > 0 {
// connect to the broker // connect to the broker
if err := config.Broker.Connect(config.Context); err != nil { if err = config.Broker.Connect(config.Context); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "Broker [%s] connect error: %v", config.Broker.String(), err) config.Logger.Errorf(config.Context, "Broker [%s] connect error: %v", config.Broker.String(), err)
} }
@ -838,26 +781,31 @@ func (g *grpcServer) Start() error {
} }
// use RegisterCheck func before register // use RegisterCheck func before register
if err := g.opts.RegisterCheck(config.Context); err != nil { // nolint: nestif
if err = g.opts.RegisterCheck(config.Context); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "Server %s-%s register check error: %s", config.Name, config.Id, err) config.Logger.Errorf(config.Context, "Server %s-%s register check error: %s", config.Name, config.ID, err)
} }
} else { } else {
// announce self to the world // announce self to the world
if err := g.Register(); err != nil { if err = g.Register(); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "Server register error: %v", err) config.Logger.Errorf(config.Context, "Server register error: %v", err)
} }
} }
} }
if err = g.subscribe(); err != nil {
return err
}
// micro: go ts.Accept(s.accept) // micro: go ts.Accept(s.accept)
go func() { go func() {
if err := g.srv.Serve(ts); err != nil { if err = g.srv.Serve(ts); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "gRPC Server start error: %v", err) config.Logger.Errorf(config.Context, "gRPC Server start error: %v", err)
} }
if err := g.Stop(); err != nil { if err = g.Stop(); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "gRPC Server stop error: %v", err) config.Logger.Errorf(config.Context, "gRPC Server stop error: %v", err)
} }
@ -886,25 +834,26 @@ func (g *grpcServer) Start() error {
registered := g.registered registered := g.registered
g.RUnlock() g.RUnlock()
rerr := g.opts.RegisterCheck(g.opts.Context) rerr := g.opts.RegisterCheck(g.opts.Context)
// nolint: nestif
if rerr != nil && registered { if rerr != nil && registered {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "Server %s-%s register check error: %s, deregister it", config.Name, config.Id, rerr) config.Logger.Errorf(config.Context, "Server %s-%s register check error: %s, deregister it", config.Name, config.ID, rerr)
} }
// deregister self in case of error // deregister self in case of error
if err := g.Deregister(); err != nil { if err = g.Deregister(); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "Server %s-%s deregister error: %s", config.Name, config.Id, err) config.Logger.Errorf(config.Context, "Server %s-%s deregister error: %s", config.Name, config.ID, err)
} }
} }
} else if rerr != nil && !registered { } else if rerr != nil && !registered {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "Server %s-%s register check error: %s", config.Name, config.Id, rerr) config.Logger.Errorf(config.Context, "Server %s-%s register check error: %s", config.Name, config.ID, rerr)
} }
continue continue
} }
if err := g.Register(); err != nil { if err = g.Register(); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "Server %s-%s register error: %s", config.Name, config.Id, err) config.Logger.Errorf(config.Context, "Server %s-%s register error: %s", config.Name, config.ID, err)
} }
} }
// wait for exit // wait for exit
@ -914,9 +863,9 @@ func (g *grpcServer) Start() error {
} }
// deregister self // deregister self
if err := g.Deregister(); err != nil { if err = g.Deregister(); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "Server deregister error: ", err) config.Logger.Errorf(config.Context, "Server deregister error: %v", err)
} }
} }
@ -935,7 +884,7 @@ func (g *grpcServer) Start() error {
select { select {
case <-exit: case <-exit:
case <-time.After(time.Second): case <-time.After(g.opts.GracefulTimeout):
g.srv.Stop() g.srv.Stop()
} }
@ -946,7 +895,7 @@ func (g *grpcServer) Start() error {
config.Logger.Infof(config.Context, "Broker [%s] Disconnected from %s", config.Broker.String(), config.Broker.Address()) config.Logger.Infof(config.Context, "Broker [%s] Disconnected from %s", config.Broker.String(), config.Broker.Address())
} }
// disconnect broker // disconnect broker
if err := config.Broker.Disconnect(config.Context); err != nil { if err = config.Broker.Disconnect(config.Context); err != nil {
if config.Logger.V(logger.ErrorLevel) { if config.Logger.V(logger.ErrorLevel) {
config.Logger.Errorf(config.Context, "Broker [%s] disconnect error: %v", config.Broker.String(), err) config.Logger.Errorf(config.Context, "Broker [%s] disconnect error: %v", config.Broker.String(), err)
} }
@ -961,7 +910,38 @@ func (g *grpcServer) Start() error {
return nil return nil
} }
func (g *grpcServer) Stop() error { func (g *Server) subscribe() error {
config := g.opts
for sb := range g.subscribers {
handler := g.createSubHandler(sb, config)
var opts []broker.SubscribeOption
if queue := sb.Options().Queue; len(queue) > 0 {
opts = append(opts, broker.SubscribeGroup(queue))
}
subCtx := config.Context
if cx := sb.Options().Context; cx != nil {
subCtx = cx
}
opts = append(opts, broker.SubscribeContext(subCtx))
opts = append(opts, broker.SubscribeAutoAck(sb.Options().AutoAck))
opts = append(opts, broker.SubscribeBodyOnly(sb.Options().BodyOnly))
if config.Logger.V(logger.InfoLevel) {
config.Logger.Infof(config.Context, "Subscribing to topic: %s", sb.Topic())
}
sub, err := config.Broker.Subscribe(subCtx, sb.Topic(), handler, opts...)
if err != nil {
return err
}
g.subscribers[sb] = []broker.Subscriber{sub}
}
return nil
}
func (g *Server) Stop() error {
g.RLock() g.RLock()
if !g.started { if !g.started {
g.RUnlock() g.RUnlock()
@ -981,14 +961,18 @@ func (g *grpcServer) Stop() error {
return err return err
} }
func (g *grpcServer) String() string { func (g *Server) String() string {
return "grpc" return "grpc"
} }
func (g *grpcServer) Name() string { func (g *Server) Name() string {
return g.opts.Name return g.opts.Name
} }
func NewServer(opts ...server.Option) server.Server { func (g *Server) GRPCServer() *grpc.Server {
return newGRPCServer(opts...) return g.srv
}
func NewServer(opts ...server.Option) *Server {
return newServer(opts...)
} }

View File

@ -3,18 +3,18 @@ package grpc
import ( import (
"reflect" "reflect"
"github.com/unistack-org/micro/v3/register" "go.unistack.org/micro/v3/register"
"github.com/unistack-org/micro/v3/server" "go.unistack.org/micro/v3/server"
) )
type rpcHandler struct { type rpcHandler struct {
name string
handler interface{}
endpoints []*register.Endpoint
opts server.HandlerOptions opts server.HandlerOptions
handler interface{}
name string
endpoints []*register.Endpoint
} }
func newRpcHandler(handler interface{}, opts ...server.HandlerOption) server.Handler { func newRPCHandler(handler interface{}, opts ...server.HandlerOption) server.Handler {
options := server.NewHandlerOptions(opts...) options := server.NewHandlerOptions(opts...)
typ := reflect.TypeOf(handler) typ := reflect.TypeOf(handler)

View File

@ -2,18 +2,19 @@ package grpc
import ( import (
"context" "context"
"crypto/tls"
"github.com/unistack-org/micro/v3/server" "go.unistack.org/micro/v3/server"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/encoding" "google.golang.org/grpc/encoding"
) )
type codecsKey struct{} type (
type grpcOptions struct{} codecsKey struct{}
type maxMsgSizeKey struct{} grpcOptions struct{}
type tlsAuth struct{} maxMsgSizeKey struct{}
type reflectionKey struct{} reflectionKey struct{}
unknownServiceHandlerKey struct{}
)
// gRPC Codec to be used to encode/decode requests for a given content type // gRPC Codec to be used to encode/decode requests for a given content type
func Codec(contentType string, c encoding.Codec) server.Option { func Codec(contentType string, c encoding.Codec) server.Option {
@ -30,25 +31,24 @@ func Codec(contentType string, c encoding.Codec) server.Option {
} }
} }
// AuthTLS should be used to setup a secure authentication using TLS
func AuthTLS(t *tls.Config) server.Option {
return setServerOption(tlsAuth{}, t)
}
// Options to be used to configure gRPC options // Options to be used to configure gRPC options
func Options(opts ...grpc.ServerOption) server.Option { func Options(opts ...grpc.ServerOption) server.Option {
return setServerOption(grpcOptions{}, opts) return server.SetOption(grpcOptions{}, opts)
} }
// //
// MaxMsgSize set the maximum message in bytes the server can receive and // MaxMsgSize set the maximum message in bytes the server can receive and
// send. Default maximum message size is 4 MB. // send. Default maximum message size is 4 MB.
//
func MaxMsgSize(s int) server.Option { func MaxMsgSize(s int) server.Option {
return setServerOption(maxMsgSizeKey{}, s) return server.SetOption(maxMsgSizeKey{}, s)
} }
// Reflection enables reflection support in grpc server // Reflection enables reflection support in grpc server
func Reflection(b bool) server.Option { func Reflection(b bool) server.Option {
return setServerOption(reflectionKey{}, b) return server.SetOption(reflectionKey{}, b)
}
// UnknownServiceHandler enables support for all services
func UnknownServiceHandler(h grpc.StreamHandler) server.Option {
return server.SetOption(unknownServiceHandlerKey{}, h)
} }

166
quic/quic_net.go Normal file
View File

@ -0,0 +1,166 @@
// grpc over quic mostly based on https://github.com/sssgun/grpc-quic
// copyright sssgun with MIT license
package grpcquic // import "go.unistack.org/micro-server-grpc/v3/quic"
import (
"context"
"crypto/tls"
"net"
"time"
quic "github.com/quic-go/quic-go"
)
///////////////////////////////////////////////////////////////////////////////
// Connection
var _ net.Conn = (*Conn)(nil)
type Conn struct {
conn quic.Connection
stream quic.Stream
}
func NewConn(conn quic.Connection) (net.Conn, error) {
stream, err := conn.OpenStreamSync(context.Background())
if err != nil {
return nil, err
}
return &Conn{conn, stream}, nil
}
// Read reads data from the connection.
// Read can be made to time out and return an Error with Timeout() == true
// after a fixed time limit; see SetDeadline and SetReadDeadline.
func (c *Conn) Read(b []byte) (n int, err error) {
return c.stream.Read(b)
}
// Write writes data to the connection.
// Write can be made to time out and return an Error with Timeout() == true
// after a fixed time limit; see SetDeadline and SetWriteDeadline.
func (c *Conn) Write(b []byte) (n int, err error) {
return c.stream.Write(b)
}
// Close closes the connection.
// Any blocked Read or Write operations will be unblocked and return errors.
func (c *Conn) Close() error {
// @TODO: log this
c.stream.Close()
return c.conn.CloseWithError(0, "")
}
// LocalAddr returns the local network address.
func (c *Conn) LocalAddr() net.Addr {
return c.conn.LocalAddr()
}
// RemoteAddr returns the remote network address.
func (c *Conn) RemoteAddr() net.Addr {
return c.conn.RemoteAddr()
}
// SetDeadline sets the read and write deadlines associated
// with the connection. It is equivalent to calling both
// SetReadDeadline and SetWriteDeadline.
//
// A deadline is an absolute time after which I/O operations
// fail with a timeout (see type Error) instead of
// blocking. The deadline applies to all future and pending
// I/O, not just the immediately following call to Read or
// Write. After a deadline has been exceeded, the connection
// can be refreshed by setting a deadline in the future.
//
// An idle timeout can be implemented by repeatedly extending
// the deadline after successful Read or Write calls.
//
// A zero value for t means I/O operations will not time out.
func (c *Conn) SetDeadline(t time.Time) error {
return c.stream.SetDeadline(t)
}
// SetReadDeadline sets the deadline for future Read calls
// and any currently-blocked Read call.
// A zero value for t means Read will not time out.
func (c *Conn) SetReadDeadline(t time.Time) error {
return c.stream.SetReadDeadline(t)
}
// SetWriteDeadline sets the deadline for future Write calls
// and any currently-blocked Write call.
// Even if write times out, it may return n > 0, indicating that
// some of the data was successfully written.
// A zero value for t means Write will not time out.
func (c *Conn) SetWriteDeadline(t time.Time) error {
return c.stream.SetWriteDeadline(t)
}
///////////////////////////////////////////////////////////////////////////////
// Listener
var _ net.Listener = (*Listener)(nil)
type Listener struct {
ql quic.Listener
}
func Listen(ql quic.Listener) net.Listener {
return &Listener{ql}
}
// Accept waits for and returns the next connection to the listener.
func (l *Listener) Accept() (net.Conn, error) {
sess, err := l.ql.Accept(context.Background())
if err != nil {
return nil, err
}
stream, err := sess.AcceptStream(context.Background())
if err != nil {
return nil, err
}
return &Conn{sess, stream}, nil
}
// Close closes the listener.
// Any blocked Accept operations will be unblocked and return errors.
func (l *Listener) Close() error {
return l.ql.Close()
}
// Addr returns the listener's network address.
func (l *Listener) Addr() net.Addr {
return l.ql.Addr()
}
///////////////////////////////////////////////////////////////////////////////
// Dialer
var QuicConfig = &quic.Config{
KeepAlivePeriod: 10 * time.Second,
}
func NewPacketConn(addr string) (net.PacketConn, error) {
// create a packet conn for outgoing connections
udpAddr, err := net.ResolveUDPAddr("udp", addr)
if err != nil {
return nil, err
}
return net.ListenUDP("udp", udpAddr)
}
func NewQuicDialer(tlsConf *tls.Config) func(context.Context, string) (net.Conn, error) {
return func(ctx context.Context, target string) (net.Conn, error) {
sess, err := quic.DialAddr(ctx, target, tlsConf, QuicConfig)
if err != nil {
return nil, err
}
return NewConn(sess)
}
}

117
quic/quic_transport.go Normal file
View File

@ -0,0 +1,117 @@
// grpc over quic mostly based on https://github.com/sssgun/grpc-quic
// copyright sssgun with MIT license
package grpcquic
import (
"context"
"crypto/tls"
"net"
"google.golang.org/grpc/credentials"
)
var _ credentials.AuthInfo = (*Info)(nil)
// Info contains the auth information
type Info struct {
conn *Conn
}
func NewInfo(c *Conn) *Info {
return &Info{c}
}
// AuthType returns the type of Info as a string.
func (i *Info) AuthType() string {
return "quic-tls"
}
func (i *Info) Conn() net.Conn {
return i.conn
}
var _ credentials.TransportCredentials = (*Credentials)(nil)
type Credentials struct {
tlsConfig *tls.Config
isQuicConnection bool
serverName string
grpcCreds credentials.TransportCredentials
}
func NewCredentials(tlsConfig *tls.Config) credentials.TransportCredentials {
grpcCreds := credentials.NewTLS(tlsConfig)
return &Credentials{
grpcCreds: grpcCreds,
tlsConfig: tlsConfig,
}
}
// ClientHandshake does the authentication handshake specified by the corresponding
// authentication protocol on rawConn for clients. It returns the authenticated
// connection and the corresponding auth information about the connection.
// Implementations must use the provided context to implement timely cancellation.
// gRPC will try to reconnect if the error returned is a temporary error
// (io.EOF, context.DeadlineExceeded or err.Temporary() == true).
// If the returned error is a wrapper error, implementations should make sure that
// the error implements Temporary() to have the correct retry behaviors.
//
// If the returned net.Conn is closed, it MUST close the net.Conn provided.
func (pt *Credentials) ClientHandshake(ctx context.Context, authority string, conn net.Conn) (net.Conn, credentials.AuthInfo, error) {
if c, ok := conn.(*Conn); ok {
pt.isQuicConnection = true
return conn, NewInfo(c), nil
}
return pt.grpcCreds.ClientHandshake(ctx, authority, conn)
}
// ServerHandshake does the authentication handshake for servers. It returns
// the authenticated connection and the corresponding auth information about
// the connection.
//
// If the returned net.Conn is closed, it MUST close the net.Conn provided.
func (pt *Credentials) ServerHandshake(conn net.Conn) (net.Conn, credentials.AuthInfo, error) {
if c, ok := conn.(*Conn); ok {
pt.isQuicConnection = true
ainfo := NewInfo(c)
return conn, ainfo, nil
}
return pt.grpcCreds.ServerHandshake(conn)
}
// Info provides the ProtocolInfo of this Credentials.
func (pt *Credentials) Info() credentials.ProtocolInfo {
if pt.isQuicConnection {
return credentials.ProtocolInfo{
// ProtocolVersion is the gRPC wire protocol version.
ProtocolVersion: "/quic/1.0.0",
// SecurityProtocol is the security protocol in use.
SecurityProtocol: "quic-tls",
// SecurityVersion is the security protocol version.
// SecurityVersion: "1.2.0",
// ServerName is the user-configured server name.
ServerName: pt.serverName,
}
}
return pt.grpcCreds.Info()
}
// Clone makes a copy of this Credentials.
func (pt *Credentials) Clone() credentials.TransportCredentials {
return &Credentials{
tlsConfig: pt.tlsConfig.Clone(),
grpcCreds: pt.grpcCreds.Clone(),
}
}
// OverrideServerName overrides the server name used to verify the hostname on the returned certificates from the server.
// gRPC internals also use it to override the virtual hosting name if it is set.
// It must be called before dialing. Currently, this is only used by grpclb.
func (pt *Credentials) OverrideServerName(name string) error {
pt.serverName = name
return pt.grpcCreds.OverrideServerName(name)
}

View File

@ -1,3 +1,5 @@
// +build ignore
/* /*
* *
* Copyright 2016 gRPC authors. * Copyright 2016 gRPC authors.

View File

@ -3,31 +3,34 @@ package grpc
import ( import (
"io" "io"
"github.com/unistack-org/micro/v3/codec" "go.unistack.org/micro/v3/codec"
"github.com/unistack-org/micro/v3/metadata" "go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v3/server"
)
var (
_ server.Request = &rpcRequest{}
_ server.Message = &rpcMessage{}
) )
type rpcRequest struct { type rpcRequest struct {
rw io.ReadWriter rw io.ReadWriter
service string payload interface{}
method string
endpoint string
target string
contentType string
codec codec.Codec codec codec.Codec
header metadata.Metadata header metadata.Metadata
body []byte method string
endpoint string
contentType string
service string
stream bool stream bool
payload interface{}
} }
type rpcMessage struct { type rpcMessage struct {
payload interface{}
codec codec.Codec
header metadata.Metadata
topic string topic string
contentType string contentType string
payload interface{}
header metadata.Metadata
body []byte
codec codec.Codec
} }
func (r *rpcRequest) ContentType() string { func (r *rpcRequest) ContentType() string {
@ -43,7 +46,7 @@ func (r *rpcRequest) Method() string {
} }
func (r *rpcRequest) Endpoint() string { func (r *rpcRequest) Endpoint() string {
return r.method return r.endpoint
} }
func (r *rpcRequest) Codec() codec.Codec { func (r *rpcRequest) Codec() codec.Codec {
@ -78,7 +81,7 @@ func (r *rpcMessage) Topic() string {
return r.topic return r.topic
} }
func (r *rpcMessage) Payload() interface{} { func (r *rpcMessage) Body() interface{} {
return r.payload return r.payload
} }
@ -86,10 +89,6 @@ func (r *rpcMessage) Header() metadata.Metadata {
return r.header return r.header
} }
func (r *rpcMessage) Body() []byte {
return r.body
}
func (r *rpcMessage) Codec() codec.Codec { func (r *rpcMessage) Codec() codec.Codec {
return r.codec return r.codec
} }

View File

@ -3,18 +3,17 @@ package grpc
import ( import (
"io" "io"
"github.com/unistack-org/micro/v3/codec" "go.unistack.org/micro/v3/codec"
"github.com/unistack-org/micro/v3/metadata" "go.unistack.org/micro/v3/metadata"
"go.unistack.org/micro/v3/server"
) )
var _ server.Response = &rpcResponse{}
type rpcResponse struct { type rpcResponse struct {
rw io.ReadWriter rw io.ReadWriter
header metadata.Metadata header metadata.Metadata
codec codec.Codec codec codec.Codec
endpoint string
service string
method string
target string
} }
func (r *rpcResponse) Codec() codec.Codec { func (r *rpcResponse) Codec() codec.Codec {

View File

@ -14,37 +14,35 @@ import (
"unicode" "unicode"
"unicode/utf8" "unicode/utf8"
"github.com/unistack-org/micro/v3/server" "go.unistack.org/micro/v3/server"
) )
var ( // Precompute the reflect type for error. Can't use error directly
// Precompute the reflect type for error. Can't use error directly // because Typeof takes an empty interface value. This is annoying.
// because Typeof takes an empty interface value. This is annoying. var typeOfError = reflect.TypeOf((*error)(nil)).Elem()
typeOfError = reflect.TypeOf((*error)(nil)).Elem()
)
type methodType struct { type methodType struct {
method reflect.Method
ArgType reflect.Type ArgType reflect.Type
ReplyType reflect.Type ReplyType reflect.Type
ContextType reflect.Type ContextType reflect.Type
method reflect.Method
stream bool stream bool
} }
type reflectionType func(context.Context, server.Stream) error // type reflectionType func(context.Context, server.Stream) error
type service struct { type service struct {
name string // name of service typ reflect.Type
rcvr reflect.Value // receiver of methods for the service method map[string]*methodType
typ reflect.Type // type of the receiver rcvr reflect.Value
method map[string]*methodType // registered methods name string
} }
// server represents an RPC Server. // server represents an RPC Server.
type rServer struct { type rServer struct {
mu sync.RWMutex // protects the serviceMap
serviceMap map[string]*service serviceMap map[string]*service
reflection bool mu sync.RWMutex
// reflection bool
} }
// Is this an exported - upper case - name? // Is this an exported - upper case - name?
@ -91,15 +89,14 @@ func prepareEndpoint(method reflect.Method) (*methodType, error) {
return nil, fmt.Errorf("method %v of %v has wrong number of ins: %v", mname, mtype, mtype.NumIn()) return nil, fmt.Errorf("method %v of %v has wrong number of ins: %v", mname, mtype, mtype.NumIn())
} }
if stream { switch stream {
case true:
// check stream type // check stream type
streamType := reflect.TypeOf((*server.Stream)(nil)).Elem() streamType := reflect.TypeOf((*server.Stream)(nil)).Elem()
if !argType.Implements(streamType) { if !argType.Implements(streamType) {
return nil, fmt.Errorf("%v argument does not implement Streamer interface: %v", mname, argType) return nil, fmt.Errorf("%v argument does not implement Streamer interface: %v", mname, argType)
} }
} else { default:
// if not stream check the replyType
// First arg need not be a pointer. // First arg need not be a pointer.
if !isExportedOrBuiltinType(argType) { if !isExportedOrBuiltinType(argType) {
return nil, fmt.Errorf("%v argument type not exported: %v", mname, argType) return nil, fmt.Errorf("%v argument type not exported: %v", mname, argType)

View File

@ -3,7 +3,7 @@ package grpc
import ( import (
"context" "context"
"github.com/unistack-org/micro/v3/server" "go.unistack.org/micro/v3/server"
"google.golang.org/grpc" "google.golang.org/grpc"
) )

View File

@ -4,25 +4,18 @@ import (
"context" "context"
"fmt" "fmt"
"reflect" "reflect"
"runtime/debug"
"strings" "strings"
"github.com/unistack-org/micro/v3/broker" "go.unistack.org/micro/v3/broker"
"github.com/unistack-org/micro/v3/errors" "go.unistack.org/micro/v3/metadata"
"github.com/unistack-org/micro/v3/logger" "go.unistack.org/micro/v3/register"
"github.com/unistack-org/micro/v3/metadata" "go.unistack.org/micro/v3/server"
"github.com/unistack-org/micro/v3/register"
"github.com/unistack-org/micro/v3/server"
)
const (
subSig = "func(context.Context, interface{}) error"
) )
type handler struct { type handler struct {
method reflect.Value
reqType reflect.Type reqType reflect.Type
ctxType reflect.Type ctxType reflect.Type
method reflect.Value
} }
type subscriber struct { type subscriber struct {
@ -106,17 +99,8 @@ func newSubscriber(topic string, sub interface{}, opts ...server.SubscriberOptio
} }
} }
func (g *grpcServer) createSubHandler(sb *subscriber, opts server.Options) broker.Handler { func (g *Server) createSubHandler(sb *subscriber, opts server.Options) broker.Handler {
return func(p broker.Event) (err error) { return func(p broker.Event) (err error) {
defer func() {
if r := recover(); r != nil {
if g.opts.Logger.V(logger.ErrorLevel) {
g.opts.Logger.Error(g.opts.Context, "panic recovered: ", r)
g.opts.Logger.Error(g.opts.Context, string(debug.Stack()))
}
err = errors.InternalServerError(g.opts.Name+".subscriber", "panic recovered: %v", r)
}
}()
msg := p.Message() msg := p.Message()
// if we don't have headers, create empty map // if we don't have headers, create empty map
@ -126,8 +110,8 @@ func (g *grpcServer) createSubHandler(sb *subscriber, opts server.Options) broke
ct := msg.Header["Content-Type"] ct := msg.Header["Content-Type"]
if len(ct) == 0 { if len(ct) == 0 {
msg.Header["Content-Type"] = defaultContentType msg.Header["Content-Type"] = DefaultContentType
ct = defaultContentType ct = DefaultContentType
} }
cf, err := g.newCodec(ct) cf, err := g.newCodec(ct)
if err != nil { if err != nil {
@ -175,7 +159,7 @@ func (g *grpcServer) createSubHandler(sb *subscriber, opts server.Options) broke
vals = append(vals, reflect.ValueOf(ctx)) vals = append(vals, reflect.ValueOf(ctx))
} }
vals = append(vals, reflect.ValueOf(msg.Payload())) vals = append(vals, reflect.ValueOf(msg.Body()))
returnValues := handler.method.Call(vals) returnValues := handler.method.Call(vals)
if rerr := returnValues[0].Interface(); rerr != nil { if rerr := returnValues[0].Interface(); rerr != nil {
@ -195,14 +179,13 @@ func (g *grpcServer) createSubHandler(sb *subscriber, opts server.Options) broke
if g.wg != nil { if g.wg != nil {
defer g.wg.Done() defer g.wg.Done()
} }
err := fn(ctx, &rpcMessage{ cerr := fn(ctx, &rpcMessage{
topic: sb.topic, topic: sb.topic,
contentType: ct, contentType: ct,
payload: req.Interface(), payload: req.Interface(),
header: msg.Header, header: msg.Header,
body: msg.Body,
}) })
results <- err results <- cerr
}() }()
} }
var errors []string var errors []string

View File

@ -39,6 +39,7 @@ func serviceMethod(m string) (string, string, error) {
return parts[0], parts[1], nil return parts[0], parts[1], nil
} }
/*
// ServiceFromMethod returns the service // ServiceFromMethod returns the service
// /service.Foo/Bar => service // /service.Foo/Bar => service
func serviceFromMethod(m string) string { func serviceFromMethod(m string) string {
@ -55,3 +56,4 @@ func serviceFromMethod(m string) string {
parts = strings.Split(parts[1], ".") parts = strings.Split(parts[1], ".")
return strings.Join(parts[:len(parts)-1], ".") return strings.Join(parts[:len(parts)-1], ".")
} }
*/