mirror of
https://github.com/go-micro/go-micro.git
synced 2025-03-03 15:22:30 +02:00
Add grpc,memory,quic transport automatically discover (#2237)
* Add grpc,memory,quic transport automatically discover * Add grpc,memory,quic transport automatically discover
This commit is contained in:
parent
993e2f55bd
commit
a159598f36
@ -10,7 +10,7 @@ import (
|
||||
maddr "github.com/asim/go-micro/v3/util/addr"
|
||||
mnet "github.com/asim/go-micro/v3/util/net"
|
||||
mls "github.com/asim/go-micro/v3/util/tls"
|
||||
|
||||
"github.com/asim/go-micro/v3/cmd"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
|
||||
@ -27,6 +27,10 @@ type grpcTransportListener struct {
|
||||
tls *tls.Config
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd.DefaultTransports["grpc"] = NewTransport
|
||||
}
|
||||
|
||||
func getTLSConfig(addr string) (*tls.Config, error) {
|
||||
hosts := []string{addr}
|
||||
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"github.com/asim/go-micro/v3/transport"
|
||||
maddr "github.com/asim/go-micro/v3/util/addr"
|
||||
mnet "github.com/asim/go-micro/v3/util/net"
|
||||
"github.com/asim/go-micro/v3/cmd"
|
||||
)
|
||||
|
||||
type memorySocket struct {
|
||||
@ -53,6 +54,10 @@ type memoryTransport struct {
|
||||
listeners map[string]*memoryListener
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd.DefaultTransports["memory"] = NewTransport
|
||||
}
|
||||
|
||||
func (ms *memorySocket) Recv(m *transport.Message) error {
|
||||
ms.RLock()
|
||||
defer ms.RUnlock()
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"encoding/gob"
|
||||
"github.com/asim/go-micro/v3/cmd"
|
||||
"time"
|
||||
|
||||
"github.com/asim/go-micro/v3/transport"
|
||||
@ -34,6 +35,10 @@ type quicListener struct {
|
||||
opts transport.ListenOptions
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd.DefaultTransports["quic"] = NewTransport
|
||||
}
|
||||
|
||||
func (q *quicClient) Close() error {
|
||||
return q.quicSocket.st.Close()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user