142 Commits

Author SHA1 Message Date
1741eece94 error when user handler returns not micro.Error or proto.Message error
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 22:20:07 +03:00
4da14b61c1 update micro to v3.1.1
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:17:42 +03:00
a149084e9a move useful options to micro repo
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-12-15 11:56:11 +03:00
36040a5765 codec rewrite
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-11-26 01:17:21 +03:00
241e452ecf import related code from micro repo
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-11-05 23:45:50 +03:00
31c35661ae simplify
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-11-05 02:01:37 +03:00
ad418b5905 small fix
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-11-05 01:56:02 +03:00
78ef338fe3 fix service caching
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-11-05 01:43:34 +03:00
017f5600e7 reuse helpers for register/deregister
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-11-05 01:23:36 +03:00
ef9ccf1615 fix logger usage
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-11-05 00:50:40 +03:00
46ed1f8fa4 fix for latest micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-11-03 02:15:31 +03:00
edaf9eaaa6 proper fill server metadata
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-10-29 21:11:24 +03:00
2f6c352a57 restart server on Init
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-10-16 16:15:39 +03:00
e6f7ceb900 fixup for never micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-10-16 12:29:28 +03:00
bc66ccb9d3 use helper
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-10-09 17:47:48 +03:00
d907057790 add missing metadata
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-10-09 17:44:04 +03:00
ff05219e28 use helper
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-10-09 17:42:55 +03:00
4209736cb8 move extractor to micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-10-09 16:26:35 +03:00
0d3d13b7ab add warning when handler returns not *errors.Error or proto.Message error type
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-10-08 13:42:27 +03:00
a41e085d18 not use internal protobuf to transfer error
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-10-08 13:18:23 +03:00
c62755cdae move errors to internal
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-28 12:12:52 +03:00
2c03ee8ec6 use own fork
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 16:08:45 +03:00
wangxu
a186c70446 add log grpc handler err (#1973)
Co-authored-by: wangxu <wangxu@oneniceapp.com>
2020-09-20 15:11:09 +03:00
Asim Aslam
67f3adcafd Revert "grpc: avoid allocations for each message (#1939)" (#1941)
This reverts commit 2a23224d911b0aeccf0614afb937a18ad7d59bca.
2020-09-20 15:11:09 +03:00
a8144c0d7c grpc: avoid allocations for each message (#1939)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:09 +03:00
Asim Aslam
242c0acf1e Decruft the broker by removing Event interface (#1940) 2020-09-20 15:11:09 +03:00
Asim Aslam
f2c5da457e remove print statement 2020-09-20 15:11:09 +03:00
Asim Aslam
393577e5e6 add a noop registry 2020-09-20 15:11:09 +03:00
Asim Aslam
c258ff3ca4 embed grpc server stream and client so they can be accessed (#1916) 2020-09-20 15:11:09 +03:00
Asim Aslam
3703769758 Return service name in error 2020-09-20 15:11:09 +03:00
Asim Aslam
b021fcb130 v3 refactor (#1868)
* Move to v3

Co-authored-by: Ben Toogood <bentoogood@gmail.com>
2020-09-20 15:11:09 +03:00
Asim Aslam
04cfa870dd remove auth provider 2020-09-20 15:11:09 +03:00
王旭
b1988daa4e server.Init(Wait(nil)) update server options context (#1804)
Co-authored-by: wangxu <wangxu@oneniceapp.com>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-09-20 15:11:09 +03:00
Enix Yu
f6ff36f501 Add recover in grpc service handler (#1727)
* 🐛 bug(grpc): add missing recover in grpc unkonwn service handler

* Add grpc handler recover testcases

* improve test case

Co-authored-by: ben-toogood <bentoogood@gmail.com>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-09-20 15:11:09 +03:00
ben-toogood
12ac73e50b server/{grpc,rpc}: fix deregister domain bug (#1742)
* server/{grpc,rpc}: fix deregister domain bug

* server/grpc: remove unnecessary slice
2020-09-20 15:11:09 +03:00
ben-toogood
c58690b414 server: register in the services namespace (#1718) 2020-09-20 15:11:09 +03:00
Asim Aslam
8c937eabb9 Registration Retry / Interval (#1651)
* Change the default ttl to 90 seconds

* add retries to registration

* Add retry to web register
2020-09-20 15:11:09 +03:00
Socket
eac461041a unsubscribe can async (#1596)
Co-authored-by: huangshaojie <huangshaojie@corp.netease.com>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-09-20 15:11:09 +03:00
Asim Aslam
ac3ce1ec16 change logging for service startup 2020-09-20 15:11:09 +03:00
655bf08aca server: set registered only after configuring subscribers (#1557)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:09 +03:00
Asim Aslam
25c4c7f7c4 fix typo 2020-09-20 15:11:09 +03:00
f349c7723f minimize allocations (#1472)
* server: minimize allocations on re-register

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: stop old instance before Init()

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* client/grpc: fix allocations in protobuf marshal

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* codec/json: fix allocations in protobuf marshal

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* remove stop from init

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* codec/grpc: expose MaxMessageSize

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* codec: use buffer pool

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* metadata: minimize reallocations

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* util/wrapper: use metadata helper

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* registry/cache: move logs to debug level

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: move logs to debug level

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: cache service only when Advertise is ip addr

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: use metadata.Copy

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:09 +03:00
Asim Aslam
bf7cb081f4 fix server logging (#1417) 2020-09-20 15:11:09 +03:00
422f951014 grpc client/server fixes (#1355)
* grpc client/server fixes

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:09 +03:00
b722b4338b Revert "server/grpc: fix ordering of register and check for registered (#1338)" (#1341)
This reverts commit 62a644ddd898a75a19b89106312c1cf58f4acd70.

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:09 +03:00
d83b49c634 server/grpc: fix ordering of register and check for registered (#1338)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:09 +03:00
05b18c03dc minimize allocations in logger and tunnel code (#1323)
* logs alloc

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* tunnel allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* try to fix tunnel

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* cache cipher for send

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:09 +03:00
6ebe79538a various fixes (#1267)
* logger: remove Panic log level

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: add missing Unlock in Subscribe error

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server: minor code change

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: extend test suite with pub/sub testing

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: fix invalid check and allow subscriber error to be returned

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: add pubsub tests

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* client/grpc: check for nil req/rsp

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:09 +03:00
f727b75b6f server/grpc: add MaxConn option to limit max inflight requests (#1247)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
28ef20ef4a prune util/log and user logger (#1237)
* prune util/log and user logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* plaintext logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* add newline

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
Lars Lehtonen
cf4b4aecda server/grpc: Prune Unused Code (#1220)
* server/grpc: remove unused grpcServer.newCodec()

* server/grpc: remove unused defaultRPCCodecs
2020-09-20 15:11:08 +03:00
70cc7c93ef fixes for safe conversation and avoid panics (#1213)
* fixes for safe convertation

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix client publish panic

If broker connect returns error we dont check it status and use
it later to publish message, mostly this is unexpected because
broker connection failed and we cant use it.
Also proposed solution have benefit - we flag connection status
only when we have succeseful broker connection

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/handler/broker: fix possible broker publish panic

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
Asim Aslam
d89db33c07 add tls config to server (#1202)
* add tls config

* add TLSConfig to acme provider
2020-09-20 15:11:08 +03:00
Asim Aslam
471d2205bd accept Listen option in grpc server (#1201) 2020-09-20 15:11:08 +03:00
816bfec4a0 various fixes for broker and messaging in server (#1187)
* provide broker disconnect messages in server

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* broker/eats: another fix

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
e56b65ecce pass micro errors from grpc server to grpc client (#1167)
* pass micro errors from grpc server to grpc client

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* wrap micro errors.Error to grpc status

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
704e7e3e94 fix map race condition in grpc server
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
6b5eb3555b fix import paths for v2 release
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
Asim Aslam
e45a20a7f3 strip sub comments 2020-09-20 15:11:08 +03:00
Asim Aslam
3a1515040f only connect broker if there are subscribers 2020-09-20 15:11:08 +03:00
Asim Aslam
ab6334fad1 Add broker comments on server subscribe 2020-09-20 15:11:08 +03:00
Asim Aslam
df710d9efc hard stop if graceful stop fails after 1 second 2020-09-20 15:11:08 +03:00
Asim Aslam
256d79a47f do not wait to stop 2020-09-20 15:11:08 +03:00
08fe30da46 pass additional context for broker subscribe (#1105)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
Asim Aslam
74e52bdb3e fix grpc json streaming by setting content sub type (#1089) 2020-09-20 15:11:08 +03:00
Asim Aslam
aa7d6aada3 fix log streaming 2020-09-20 15:11:08 +03:00
Asim Aslam
c61072ccb9 Moving to gRPC by default (#1069)
* Step 1

* Fix the test panics
2020-09-20 15:11:08 +03:00
e2e6425e65 linting fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
Astone
e13e329abc improve code quality 2020-09-20 15:11:08 +03:00
Astone
4cba1b3ec9 optimize: a better way for return error 2020-09-20 15:11:08 +03:00
Asim Aslam
15b405b1a9 The mega cruft proxy PR (#974)
* the mega cruft proxy PR

* Rename broker id

* add protocol=grpc

* fix compilation breaks

* Add the tunnel broker to the network

* fix broker id

* continue to be backwards compatible in the protocol
2020-09-20 15:11:08 +03:00
d0222ee239 return error to caller on grpc server request processing (#962)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
Till Knuesting
592f1fb218 preallocated slices (#934) 2020-09-20 15:11:08 +03:00
Yang Shi
5cc92860a6 improve the log of panic recovering (#906) 2020-09-20 15:11:08 +03:00
tegk
a5978b5470 used gofmt with -s flag on whole project 2020-09-20 15:11:08 +03:00
Shu Xian
94f5ccf378 recover handler if panic 2020-09-20 15:11:08 +03:00
Milos Gajdos
a037094a31 Lock started flag when changing it. 2020-09-20 15:11:08 +03:00
Milos Gajdos
65733b8268 Make server starts and stops idempotent 2020-09-20 15:11:08 +03:00
johnson
f9dcbb71be update service not found error tooltip
fixing test failed issue

change back error type
change registry.ErrNotFound back to selector.ErrNotFound

change back error type
change registry.ErrNotFound back to selector.ErrNotFound

remove the single node tunnel test

Fix read yaml config from memory

package main

import (
	"fmt"

	"github.com/micro/go-micro/config"
	"github.com/micro/go-micro/config/source/memory"
)

var configData = []byte(`
2020-09-20 15:11:08 +03:00
Asim Aslam
b7ee22d993 Add monitor/debug packages 2020-09-20 15:11:08 +03:00
Asim Aslam
35364b037b fix broker log line 2020-09-20 15:11:08 +03:00
c0e32da83e bunch of other ipv6 fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
5aad839816 fix ipv6 addr parsing and using
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:08 +03:00
Asim Aslam
df9fa0c938 Remove Port from registry 2020-09-20 15:11:08 +03:00
Asim Aslam
b3f501e789 strip broker address 2020-09-20 15:11:08 +03:00
Asim Aslam
5a7113b669 add peer in context 2020-09-20 15:11:08 +03:00
Asim Aslam
d09a33b43c fix grpc proto wrapper 2020-09-20 15:11:08 +03:00
Asim Aslam
4651f11492 Add working grpc proxy config 2020-09-20 15:11:08 +03:00
Asim Aslam
ac860f37e2 add cruft 2020-09-20 15:11:08 +03:00
Asim Aslam
0635d2c2ca check in this cruft 2020-09-20 15:11:08 +03:00
Asim Aslam
eaae419939 strip use of cmd 2020-09-20 15:11:08 +03:00
Asim Aslam
8a3538eb77 Further consolidate the libraries 2020-09-20 15:11:08 +03:00