Commit Graph

82 Commits

Author SHA1 Message Date
ben-toogood
422fd980e9 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-18 16:32:53 +03:00
ben-toogood
ea93f93b18 selector: use custom domain (#1760)
* util/wrapper: improve auth errors

* client: add network call option

* client/selector: add domain select option

* client/grpc: pass network option to selector
2020-09-18 16:32:53 +03:00
ben-toogood
9683d38d19 Apply wrappers to gRPC streams (#1675)
* Add wrappers to grpc streams

* Fix typo
2020-09-18 16:32:53 +03:00
Asim Aslam
ace96191fe force codec on call not on dial (#1599) 2020-09-18 16:32:53 +03:00
Ben Toogood
a928fc196e Auth Client Wrapper 2020-09-18 16:32:53 +03:00
750b6d4733 broker: add publish context (#1590)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-18 16:32:53 +03:00
Asim Aslam
e9db13acab Add network proxying (#1556)
* Add network proxying

* go fmt
2020-09-18 16:32:53 +03:00
Ben Toogood
dfd784d4fa Set authorization header on grpc stream 2020-09-18 16:32:53 +03:00
e0f64db92c 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-18 16:32:53 +03:00
Ben Toogood
1a06552877 Further Refactoring 2020-09-18 16:32:52 +03:00
Asim Aslam
5a443abaf1 add stream timeout option which defaults to 0 (#1456)
* add stream timeout option which defaults to 0

* fix option
2020-09-18 16:32:52 +03:00
Ben Toogood
f03cb96217 Fallback to service token 2020-09-18 16:32:52 +03:00
Ben Toogood
cd1f6fcdc2 ServicePrivileges => ServiceToken 2020-09-18 16:32:52 +03:00
Ben Toogood
c5e30c0e6e Fixes for CLI login 2020-09-18 16:32:52 +03:00
Ben Toogood
84a7cab60b WithServicePrivileges => ServicePrivileges 2020-09-18 16:32:52 +03:00
Ben Toogood
21a246ad02 Service => Service Auth 2020-09-18 16:32:52 +03:00
Socket
d5a54ecfa4 grpc pool should check state (#1435)
Co-authored-by: huangshaojie <huangshaojie@corp.netease.com>
2020-09-18 16:32:52 +03:00
ben-toogood
3ae8bc25f2 Add ContextWithToken (#1407)
* Add ContextWithToken

* Tidying up BearerScheme

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-09-18 16:32:52 +03:00
1969a92b6e client/grpc: remove json-iterator usage (#1387)
* minimize external deps and binary size
* if user wants json-iterator codec it must be used in server and
  client code. so best to use it via go-plugins

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-18 16:32:52 +03:00
84a19c5dff grpc client/server fixes (#1355)
* grpc client/server fixes

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-18 16:32:52 +03:00
0e1d8c4e47 client/grpc: unwrap error after call (#1352)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-18 16:32:52 +03:00
ben-toogood
284a4ee0a3 grpc client error fix (#1351)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-09-18 16:32:52 +03:00
ben-toogood
4f5a19bf30 Fix Auth Headers (#1324)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-09-18 16:32:52 +03:00
Asim Aslam
d0c0366e0c add websocket streaming to api rpc handler (#1326) 2020-09-18 16:32:52 +03:00
ben-toogood
42e9cc97e8 Implement config singleton (#1268)
* Implement config singleton

* Pass token in grpc request headers

* Refactor BearerScheme

* Fix typo
2020-09-18 16:32:52 +03:00
cb22a88ba3 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-18 16:32:52 +03:00
Asim Aslam
301bb127ce add MICRO_AUTH_TOKEN, parse token in wrapper, preload config and othe… (#1261)
* add MICRO_AUTH_TOKEN, parse token in wrapper, preload config and other things

* fix wrapper panic
2020-09-18 16:32:52 +03:00
ben-toogood
2430925ea3 Refactor auth: add token and store implementations (#1230)
* Refactor auth: add token and memory implementations

* Fix typo

* Remove memory auth (implemented already by the store implementation), revert default to noop

* Add grpc header

* Global Config

* config/global => util/config

* Rename package to remove confict

* Tweak

* Improve Error Handling
2020-09-18 16:32:52 +03:00
144014db34 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-18 16:32:52 +03:00
Asim Aslam
f91ec84d59 secure the grpc client (#1215)
* secure the grpc client

* make compile

* Add system cert pool

* Revert manually adding ca certs

* Tweak comment

Co-authored-by: ben-toogood <bentoogood@gmail.com>
2020-09-18 16:32:52 +03:00
b00167520c 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-18 16:32:52 +03:00
ben-toogood
5b60299d47 Ignore gRPC Proxy (#1205) 2020-09-18 16:32:52 +03:00
Asim Aslam
4a6f438db2 normalise proxy name (#1203) 2020-09-18 16:32:52 +03:00
Asim Aslam
6460839705 when the stream errors cleanup the connection (#1199) 2020-09-18 16:32:52 +03:00
Asim Aslam
5657fd07d2 set dial timeout in stream 2020-09-18 16:32:52 +03:00
978659a441 client/grpc: fix panic on invalid message (#1191)
* client/grpc: fix panic on invalid message
* travis: disable lint and race for now

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-18 16:32:52 +03:00
a5a238d554 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-18 16:32:52 +03:00
8740815c56 fix ctx.Done issue #720 (#1166)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-18 16:32:52 +03:00
0807802cea fix import paths for v2 release
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-18 16:32:52 +03:00
Asim Aslam
b65757048a cancel stream 2020-09-18 16:32:52 +03:00
Asim Aslam
5422d368c0 ensure we close the grpc stream (#1098)
* ensure we close the grpc stream

* use g.Close

* use closed bool flag for checking connection close
2020-09-18 16:32:52 +03:00
Asim Aslam
8c86ad526f fix grpc json streaming by setting content sub type (#1089) 2020-09-18 16:32:52 +03:00
Asim Aslam
7d5e31cd58 Moving to gRPC by default (#1069)
* Step 1

* Fix the test panics
2020-09-18 16:32:52 +03:00
jamsonzan
01ad981688 support streams pool for grpc (#1062)
* Update grpc_pool.go

* Update options.go

* Update grpc.go

* Update grpc_pool_test.go

* streams pool for grpc

* use busy list to speed up allocate while pool is very busy

* fix idle bug
2020-09-18 16:32:52 +03:00
Milos Gajdos
f0fd4f90a5 Fixing dead code and go vet moaning 2020-09-18 16:32:52 +03:00
b3a60ba4f1 linting fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-18 16:32:52 +03:00
Astone
1e0ca25db0 improve code quality 2020-09-18 16:32:52 +03:00
Asim Aslam
88d56e653d revert some protocol changes for now 2020-09-18 16:32:52 +03:00
dc67083701 grpc client goroutine leak fix
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-09-18 16:32:52 +03:00
Asim Aslam
9d31078176 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-18 16:32:52 +03:00