1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-18 08:26:38 +02:00
Commit Graph

176 Commits

Author SHA1 Message Date
asim
610c00859f v5 2024-06-04 21:40:43 +01:00
Morya
f28468a59c
feat: allow to set API listen address (#2680) 2023-12-18 10:29:47 +00:00
Eng Zer Jun
cbd45b12dc
Avoid allocations with (*regexp.Regexp).MatchString (#2679)
We should use `(*regexp.Regexp).MatchString` instead of
`(*regexp.Regexp).Match([]byte(...))` when matching string to avoid
unnecessary `[]byte` conversions and reduce allocations.

func BenchmarkMatch(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := versionRe.Match([]byte("v1")); !match {
			b.Fail()
		}
	}
}

func BenchmarkMatchString(b *testing.B) {
	for i := 0; i < b.N; i++ {
		if match := versionRe.MatchString("v1"); !match {
			b.Fail()
		}
	}
}

goos: linux
goarch: amd64
pkg: go-micro.dev/v4/api/handler/event
cpu: AMD Ryzen 7 PRO 4750U with Radeon Graphics
BenchmarkMatch-16          	11430127	       127.4 ns/op	       2 B/op	       1 allocs/op
BenchmarkMatchString-16    	12220628	        97.54 ns/op	       0 B/op	       0 allocs/op
PASS
ok  	go-micro.dev/v4/api/handler/event	3.822s

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-12-04 16:00:01 +00:00
Lukasz Raczylo
a7522e7d6c
fix: struct field alignment (#2632) 2023-04-26 02:16:34 +02:00
Thomas Chandelle
d392e72021
fix(api/handler): avoid zombie goroutine when connection unexpectedly closes (#2624) 2023-04-05 22:50:24 +02:00
asim
6f8930926f gofmt 2023-03-22 16:42:54 +00:00
Hellis
e337eb2c3d
fix(api): add WithRegistry option for api (#2618) 2023-03-07 17:05:25 +01:00
leoujz
0a91ba7b5d
api gateway handing http request adds Content-Type application/x-www-form-urlencoded, and extract endpoints from path if no endpoint matched (#2592)
Co-authored-by: l <l@x>
2022-11-09 04:28:39 +01:00
Rene Jochum
065f9714e9
fix: easy lint fixes to api/ (#2567) 2022-10-01 10:50:11 +02:00
Rene Jochum
010b1d9f11
fix: linting issues (#2566) 2022-09-30 20:32:55 +02:00
David Brouwer
85c0b0b8eb
fix: some linting issues (#2563) 2022-09-30 16:27:07 +02:00
Mohamed MHAMDI
1db36357d5
feat(logger): add logger option to all micro components (override DefaultLogger) closes #2556 (#2559)
* feat(logger): add logger option to all components

* fix: refactor api/rpc.go

* fix: refactor api/stream.go

* fix: api/options.go comment

* fix(logger): do not use logger.Helper internally

* fix(logger): fix comments

* fix(logger): use level.Enabled method

* fix: rename mlogger to log

* fix: run go fmt

* fix: log level

* fix: factories

Co-authored-by: Mohamed MHAMDI <mmhamdi@hubside.com>
Co-authored-by: Davincible <david.brouwer.99@gmail.com>
2022-09-29 16:44:53 +02:00
Asim Aslam
98375c7ae5 api honours naming convention of other interfaces 2022-07-11 15:49:30 +01:00
Asim Aslam
48d6650f28 rename api to gateway 2022-07-02 14:42:12 +01:00
Asim Aslam
3381a9f3db Remove body from endpoint 2022-07-02 14:38:58 +01:00
Asim Aslam
63d1f9de4a minor changes 2022-07-02 14:25:21 +01:00
Asim Aslam
e313863a2a make router configurable in api 2022-07-02 14:15:02 +01:00
Asim Aslam
73dc3723c7
Update api.go 2022-07-02 13:50:45 +01:00
Asim Aslam
667ee9b85e rename field to Versions 2022-07-02 12:35:57 +01:00
Asim Aslam
b6b866c0b2
api package (#2522)
* api gateway

* add comment
2022-07-02 12:11:59 +01:00
Asim Aslam
bfcdfc3c7f remove m3o 2022-07-01 11:37:13 +01:00
Asim Aslam
696a0ba714 Merge branch 'master' of ssh://github.com/asim/go-micro 2022-01-03 11:21:29 +00:00
Asim Aslam
267da35259 move the api client 2022-01-03 11:21:20 +00:00
Asim Aslam
0c2041e439
add events package (#2341)
* add events package

* update go version
2021-11-08 08:52:39 +00:00
Benjamin
5d5aee1f08
replace ioutil with io and os (#2327)
set the go version to 1.16 in pr.yml and tests.yml, so as to be consistent with the version in go.mod.
2021-10-30 19:24:40 +01:00
Asim Aslam
1cd7cfaa6c
go-micro.dev/v4 (#2305) 2021-10-12 12:55:53 +01:00
helloword
ad532522ea
Config CORS (#2270)
* Added cors.config for CORS

* Added cors.config for CORS

* Added cors.config for CORS

Co-authored-by: 于海洋 <yhy@iothinking.com>
2021-09-17 10:17:12 +01:00
Christoffer Åström
4c7d2e28eb
test(api): fix randomly failing rpc test (#2268) 2021-09-13 21:56:36 +01:00
Jerry
4929a7c16e
update etcd version (#2186)
Remove missing gRPC example from README.md (#2112)

Delete docker.yml

Delete Dockerfile

update plugins version & remove replace (#2118)

* update memory registry plugins version & remove replace

* update plugins version & remove replace

Co-authored-by: 申法宽 <shenfakuan@163.com>

update client/grpc plugins version & remove replace (#2119)

* update memory registry plugins version & remove replace

* update plugins version & remove replace

* update plugins/client/grpc/v3 version

Co-authored-by: 申法宽 <shenfakuan@163.com>

update etcd version (#2120)

update mod version

update

update pulgin registry mod version (#2121)

* update etcd version

* update mod version

* update

fix store delete

support for tls on http plugin (#2126)

improve code quality (#2128)

* Fix inefficient string comparison

* Fix unnecessary calls to Printf

* Canonicalize header key

* Replace `t.Sub(time.Now())` with `time.Until`

* Remove unnecessary blank (_) identifier

* Remove unnecessary use of slice

* Remove unnecessary comparison with bool

Update README.md

Update README.md

remove network package

update quic go mod

remove indirects

update etcd mod version

Update registry plugins mod version (#2130)

* update etcd version

* update mod version

* update

* update etcd mod version

Update README.md

Update README.md

Update README.md

fixing etcd stack in getToken (#2145)

when provide username and password, etcd will try to get auth token from server
if server is unavailble, etcd client will stack in
when dial timeout is set, it will return err instead of stack in

Update README.md

add http demo; http client can call http server; http client can call rpc server (#2149)

Add etcd to default registries when plugin is loaded (#2150)

Co-authored-by: Andrew Jones <andrew@gotoblink.com>

Update README.md

make rpcClient compatible with 32bit arm systems (#2156)

On ARM, 386, and 32-bit MIPS, it is the caller's responsibility to
arrange for 64-bit alignment of 64-bit words accessed
atomically. Only the first word in an allocated struct can
be relied upon to be 64-bit aligned.

optimize the process of switching grpc error to micro error (#2158)

Fix util/log/log.Infof format didn't work (#2160)

Co-authored-by: Cui Gang <cuigang@yunpbx.com>

fixing string field contains invalid UTF-8 issue (#2164)

fix k8s api memory leak (#2166)

fix http No release Broker (#2167)

* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

fix: "Solve the problem that the resources have not been fully released due to early exit" (#2168)

* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

* Solve the problem that the resources have not been fully released due to early exit

* Optimize some code

* Optimize some code

fix service default logger (#2171)

* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

* Solve the problem that the resources have not been fully released due to early exit

* Optimize some code

* Optimize some code

* Optimize some code

* fix service default logger

Update README.md

get k8s pod (#2173)

Update README.md

fix:field (#2176)

* get k8s pod

* fix: filed

* field

Update README.md

add rmq message properties (#2177)

Co-authored-by: dtitov <dtitov@might24.ru>

Update README.md

grpc server add RegisterCheck (#2178)

fix 404 bug (#2179)

fix undefined: err (#2181)

Add registry and config/source plugins based on nacos/v2 (#2182)

* Add registry plugins implement by nacos/v2

* Add config/source plugins implement by nacos/v2

support hystrix fallback (#2183)

Windows event log plugin (#2180)

* add rmq message properties

* eventlog start

* start eventlog

* windows event logger

* readme

* readme

Co-authored-by: dtitov <dtitov@might24.ru>

support etcd auth with env args (#2184)

* support etcd auth with env args
set default registry address with env arg instead of 127.0.0.1

* fixing MICRO_REGISTRY_ADDRESS may empty issue

update mod version
2021-06-29 13:40:54 +01:00
Shubhendra Singh Chauhan
26b859c4f9
improve code quality (#2128)
* Fix inefficient string comparison

* Fix unnecessary calls to Printf

* Canonicalize header key

* Replace `t.Sub(time.Now())` with `time.Until`

* Remove unnecessary blank (_) identifier

* Remove unnecessary use of slice

* Remove unnecessary comparison with bool
2021-02-25 08:30:35 +00:00
Asim Aslam
d94936f6c9
v3 (#2104)
* v3

* revert plugins

* fixup some issues
2021-01-20 13:54:31 +00:00
Asim Aslam
18fb7a5d62 move certmagic 2020-12-29 20:12:10 +00:00
Asim Aslam
a7c31a0d2b refactor all the things 2020-12-29 15:49:26 +00:00
Asim Aslam
df687fe5d4 move selector 2020-12-12 20:14:50 +00:00
Asim Aslam
dbe8c93e20
remove service implementations (#2094) 2020-12-11 11:12:44 +00:00
Dominic Wong
0327f30e3c Fix regex detection. Fixes #1663 (#1696) 2020-06-12 10:42:52 +01:00
Vasiliy Tolstov
92e9d05432 api/handler/rpc: dont log error on normal websocket error code (#1688)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-06-12 10:42:52 +01:00
Asim Aslam
b68af8ab63 run go fmt 2020-05-30 11:00:43 +01:00
Ben Toogood
dc10f88c12 Replace auth account.Namespace with account.Scopes 2020-05-19 18:17:17 +01:00
x1nchen
af2db0a0d9
fix: update dependency certmagic (#1625)
module github.com/mholt/certmagic has been renamed github.com/caddyserver/certmagic,
so upgrade on this module will fail.

fix: micro/micro#835

caddyserver/certmagic@v0.10.6 is Maximum upgradeable version with go version 1.13

Higher version use *tls.ClientHelloInfo.SupportsCertificate which only supported in go 1.14
2020-05-13 15:00:13 +01:00
Ben Toogood
f892b41299 Add runtime to service.Options() 2020-05-11 17:09:28 +01:00
Vasiliy Tolstov
90dd1f63c8
api/handler/rpc: fix encoding of inner message (#1601)
* api/handler/rpc: fix encoding of inner message

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-05-04 15:50:53 +03:00
Vasiliy Tolstov
d44adafca5
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-04-29 15:23:10 +03:00
Vasiliy Tolstov
6fa27373ed
bundle qson lib in util (#1561)
* copy qson from https://github.com/joncalhoun/qson
  as author not want to maintain repo
* latest code contains our fix to proper decode strings
  with escaped & symbol
* replace package in api/handler/rpc

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-23 11:08:09 +03:00
Asim Aslam
226d6ad22b log whats happening in http handler 2020-04-19 00:41:03 +01:00
Vasiliy Tolstov
f00fd7a49e
api/router: support pcre and google.api pattern matching (#1549)
* api/router: support pcre and google.api pattern matching

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-19 00:31:34 +03:00
Vasiliy Tolstov
62cedf64da
api/router/registry: extract path based parameters from url to req (#1530)
* api/router/registry: extract path based parameters from url to req
* api/handler/rpc: fix empty body request parsing
* bundle grpc-gateway util funcs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-15 17:50:51 +03:00
Vasiliy Tolstov
b700d425a4
api/handler/rpc: improvements and fixes (#1535)
* api/handler/rpc: fix empty body case
* api/handler/rpc: copy all request headers to metadata

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-15 01:37:15 +03:00
Vasiliy Tolstov
268651df18
regenerate all proto based files (#1531)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-14 16:25:09 +03:00
Asim Aslam
e515005083 Remove only allowing certain methods 2020-04-13 23:05:39 +01:00