Commit Graph

68 Commits

Author SHA1 Message Date
ben-toogood
1057ef6acb
Add ContextWithToken (#1407)
* Add ContextWithToken

* Tidying up BearerScheme

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-25 11:20:53 +00:00
d559587807
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-03-21 09:40:58 +00:00
ab73127063
grpc client/server fixes (#1355)
* grpc client/server fixes

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-17 14:27:20 +03:00
ac333d9d47
client/grpc: unwrap error after call (#1352)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-16 13:33:38 +03:00
ben-toogood
d91c14eb30
grpc client error fix (#1351)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-16 12:53:15 +03:00
ben-toogood
48b2a5c37c
Fix Auth Headers (#1324)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-10 16:47:01 +00:00
Asim Aslam
ed83c27f0e
add websocket streaming to api rpc handler (#1326) 2020-03-10 15:21:43 +00:00
ben-toogood
962567ef42
Implement config singleton (#1268)
* Implement config singleton

* Pass token in grpc request headers

* Refactor BearerScheme

* Fix typo
2020-02-28 12:58:27 +00:00
64a5ce9607
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-02-26 18:34:40 +00:00
Asim Aslam
6aaaf54275
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-02-25 22:15:44 +00:00
ben-toogood
ffdf986aac
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-02-24 15:07:27 +00:00
5b0175c2e5
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-02-24 14:15:20 +00:00
Asim Aslam
f4118dc357
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-02-19 08:44:35 +00:00
58598d0fe0
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-02-18 23:05:38 +00:00
ben-toogood
1e40c86dfe
Ignore gRPC Proxy (#1205) 2020-02-17 08:14:45 +00:00
Asim Aslam
b3fc8be24e
normalise proxy name (#1203) 2020-02-15 21:57:30 +00:00
Asim Aslam
c691d116ab
when the stream errors cleanup the connection (#1199) 2020-02-15 11:35:08 +00:00
Asim Aslam
d9b3b17582 set dial timeout in stream 2020-02-13 18:51:32 +00:00
6dc942bc19
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-02-13 14:57:21 +03:00
7105e4099c
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-02-06 10:18:33 +00:00
a44dc90d45
fix ctx.Done issue #720 (#1166)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-05 21:13:14 +00:00
f23638c036 fix import paths for v2 release
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-01-30 14:44:40 +03:00
Asim Aslam
9df19e826e cancel stream 2020-01-19 22:53:56 +00:00
Asim Aslam
37d1139a57
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-01-09 17:00:14 +00:00
Asim Aslam
0b8ff3a8bb
fix grpc json streaming by setting content sub type (#1089) 2020-01-07 18:37:34 +00:00
Asim Aslam
c145f355dd
Moving to gRPC by default (#1069)
* Step 1

* Fix the test panics
2019-12-29 21:07:55 +00:00
jamsonzan
22aa7d14b3 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
2019-12-27 12:25:58 +00:00
Milos Gajdos
5865e89bed
Fixing dead code and go vet moaning 2019-12-05 16:10:49 +00:00
a1eaf9cc20 linting fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-04 00:22:02 +03:00
Astone
29fb58db39 improve code quality 2019-12-03 20:59:02 +08:00
Asim Aslam
00bbb3ac61 revert some protocol changes for now 2019-11-30 21:20:33 +00:00
Asim Aslam
db03a564fb
Merge pull request #980 from unistack-org/issue-940
grpc client goroutine leak fix
2019-11-25 19:10:34 +00:00
9763820c75 grpc client goroutine leak fix
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-11-25 22:02:24 +03:00
Asim Aslam
080363e8c4
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
2019-11-25 16:31:43 +00:00
tegk
f88518d994 used gofmt with -s flag on whole project 2019-11-01 15:07:53 +00:00
orb li
77108771db Conceptual deliverable 2019-10-10 13:55:16 +08:00
orb li
226d55d752
Adding dependency 2019-10-09 16:48:45 +08:00
orb li
88ef785127 Add dialoptions and calloptions 2019-10-09 15:56:39 +08:00
Asim Aslam
0888d2fbbc Add grpc content-type 2019-08-27 08:13:58 +01:00
Asim Aslam
c44fd63301 Force grpc client/server to use grpc codec for broker 2019-08-18 11:28:21 +01:00
johnson
de34f259ba 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(`
---
a: 1234
`)

func main() {
	memorySource := memory.NewSource(
		memory.WithYAML(configData),
	)
	// Create new config
	conf := config.NewConfig()

	// Load file source
	conf.Load(memorySource)

	fmt.Println(string(conf.Bytes()))
}
2019-08-11 19:31:22 +08:00
Asim Aslam
1db98ee0f0 move all the buffer references to util/buf 2019-07-28 19:33:24 +01:00
张三
100cb9db6b
fix bug
https://github.com/micro/micro/issues/293
Send request failed using micro Content-Type application/grpc+json
2019-07-27 11:11:16 +08:00
e688ab0a45 fix ipv6 addr parsing and using
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-07-17 12:20:29 +03:00
Asim Aslam
64ec0633a3 Fix breaks and go fmt 2019-07-10 07:47:17 +01:00
Asim Aslam
0bf54c122f move transport back 2019-07-09 18:41:26 +01:00
Asim Aslam
5cd1e81ba9
Merge pull request #570 from sunfuze/grpc-json-marshal
grpc: using jsonpb.Marshaler to do Marshal, map to jsonpb.Unmarsh
2019-07-08 08:44:51 +01:00
Asim Aslam
e0bf1c2283 Remove Port from registry 2019-07-08 08:01:42 +01:00
Joe
b655f7f55a grpc: using jsonpb.Marshaler to do Marshal, map to jsonpb.Unmarsh 2019-07-08 10:32:10 +08:00
Asim Aslam
4b4ad68eb9 Change Publication to Event 2019-07-07 12:44:09 +01:00