109 Commits

Author SHA1 Message Date
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
724f1bcb70 move transport (#1967) 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
zuoan
03af0bddc6 simplifies code (#1934)
Co-authored-by: 刘海洋 <haiyang@snqu.com>
2020-09-20 15:11:09 +03:00
Asim Aslam
ed139b1fdd cleanup debug and transport (#1920) 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
9365b1fe9b Add subscriber naem 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
522e04840c ensure register ttl and interval are set 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
c69131b98c fix grpc test 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
b26f4d8dd0 Deprecate client/selector (#1767)
* client/{grpc,rpc}: depricate selector (wip)

* {client,cmd}: remove client/selector

* deprecate client/selector

* router/static: fix lookup

* config/cmd: add support for legacy static selector flag

* config/cmd: add support for legacy dns selector flag
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
ben-toogood
f815eed7fd util/wrapper: Add Static Client wrapper (#1685)
* util/wrapper: Add Static Client wrapper

* util/wrapper/static: pass address to stream too

* add static client wrapper tests

* server: fix error message spaces between words

* server/{rpc,grpc}: replace log.Error with log.Errorf

* server/grpc: fix log typo

* server/rpc: fix log typo

Co-authored-by: Vasiliy Tolstov <v.tolstov@unistack.org>
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
Ben Toogood
95ffd9ca4a Auth Options 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
19a313ac4e api/router: avoid unneeded loops and fix path match (#1594)
* api/router: avoid unneeded loops and fix path match

* if match found in google api path syntax, not try pcre loop
* if path is not ending via $ sign, append it to pcre to avoid matching other strings like
  /api/account/register can be matched to /api/account
* api: add tests and validations

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
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
213359baed vendor proto files from google (#1536)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:09 +03:00
33e3df9bdb regenerate all proto based files (#1531)
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
Ben Toogood
f874f4cc97 Fix nil grpc server auth bug 2020-09-20 15:11:09 +03:00
015d4d6d64 regenerate all proto (#1440)
* regenerate all proto

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

* regenerate from proto

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

* regenerate from proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-20 15:11:09 +03:00
b7887155ba api: add static router and improve path parser in rpc handler (#1437)
* api: add static router and improve path parser in rpc handler

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

* expose metadata context key to be able to get unmodified map keys

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

* server/grpc: fix jsonpb codec for protobuf msg

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

* api/handler/rpc: write 204 status code when rsp is nil

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

* api/handler/rpc: add check for nil response for non javascript

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
Jake Sanders
b0164dca94 Comment typo in gRPC subscriber (#1304) 2020-09-20 15:11:09 +03:00
b48f919b7b server/grpc: avoid panic in case of nil Header (#1303)
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
78d2884ced allocations improvements and tunnel fixes (#1248)
* reduce allocations in tunnel code

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

* another allocation fix

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

* allocate maps with len if it known

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

* allocate key for send once

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