Move proxy/router
This commit is contained in:
parent
2e67e23a23
commit
4030ccc27b
@ -9,9 +9,9 @@ import (
|
|||||||
|
|
||||||
"github.com/micro/go-micro/client"
|
"github.com/micro/go-micro/client"
|
||||||
"github.com/micro/go-micro/client/selector"
|
"github.com/micro/go-micro/client/selector"
|
||||||
"github.com/micro/go-micro/network/router"
|
|
||||||
pb "github.com/micro/go-micro/network/router/proto"
|
|
||||||
"github.com/micro/go-micro/registry"
|
"github.com/micro/go-micro/registry"
|
||||||
|
"github.com/micro/go-micro/router"
|
||||||
|
pb "github.com/micro/go-micro/router/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type routerSelector struct {
|
type routerSelector struct {
|
||||||
|
@ -1,337 +0,0 @@
|
|||||||
package tunnel
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/sha256"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/micro/go-micro/network/link"
|
|
||||||
"github.com/micro/go-micro/transport"
|
|
||||||
)
|
|
||||||
|
|
||||||
// tun represents a network tunnel
|
|
||||||
type tun struct {
|
|
||||||
// the link on top of which we build a tunnel
|
|
||||||
link link.Link
|
|
||||||
|
|
||||||
sync.RWMutex
|
|
||||||
|
|
||||||
// to indicate if we're connected or not
|
|
||||||
connected bool
|
|
||||||
|
|
||||||
// the send channel for all messages
|
|
||||||
send chan *message
|
|
||||||
|
|
||||||
// close channel
|
|
||||||
closed chan bool
|
|
||||||
|
|
||||||
// a map of sockets based on Micro-Tunnel-Id
|
|
||||||
sockets map[string]*socket
|
|
||||||
}
|
|
||||||
|
|
||||||
// create new tunnel on top of a link
|
|
||||||
func newTunnel(link link.Link) *tun {
|
|
||||||
return &tun{
|
|
||||||
link: link,
|
|
||||||
send: make(chan *message, 128),
|
|
||||||
closed: make(chan bool),
|
|
||||||
sockets: make(map[string]*socket),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// getSocket returns a socket from the internal socket map.
|
|
||||||
// It does this based on the Micro-Tunnel-Id and Micro-Tunnel-Session
|
|
||||||
func (t *tun) getSocket(id, session string) (*socket, bool) {
|
|
||||||
// get the socket
|
|
||||||
t.RLock()
|
|
||||||
s, ok := t.sockets[id+session]
|
|
||||||
t.RUnlock()
|
|
||||||
return s, ok
|
|
||||||
}
|
|
||||||
|
|
||||||
// newSocket creates a new socket and saves it
|
|
||||||
func (t *tun) newSocket(id, session string) (*socket, bool) {
|
|
||||||
// hash the id
|
|
||||||
h := sha256.New()
|
|
||||||
h.Write([]byte(id))
|
|
||||||
id = fmt.Sprintf("%x", h.Sum(nil))
|
|
||||||
|
|
||||||
// new socket
|
|
||||||
s := &socket{
|
|
||||||
id: id,
|
|
||||||
session: session,
|
|
||||||
closed: make(chan bool),
|
|
||||||
recv: make(chan *message, 128),
|
|
||||||
send: t.send,
|
|
||||||
wait: make(chan bool),
|
|
||||||
}
|
|
||||||
|
|
||||||
// save socket
|
|
||||||
t.Lock()
|
|
||||||
_, ok := t.sockets[id+session]
|
|
||||||
if ok {
|
|
||||||
// socket already exists
|
|
||||||
t.Unlock()
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
t.sockets[id+session] = s
|
|
||||||
t.Unlock()
|
|
||||||
|
|
||||||
// return socket
|
|
||||||
return s, true
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: use tunnel id as part of the session
|
|
||||||
func (t *tun) newSession() string {
|
|
||||||
return uuid.New().String()
|
|
||||||
}
|
|
||||||
|
|
||||||
// process outgoing messages sent by all local sockets
|
|
||||||
func (t *tun) process() {
|
|
||||||
// manage the send buffer
|
|
||||||
// all pseudo sockets throw everything down this
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case msg := <-t.send:
|
|
||||||
nmsg := &transport.Message{
|
|
||||||
Header: msg.data.Header,
|
|
||||||
Body: msg.data.Body,
|
|
||||||
}
|
|
||||||
|
|
||||||
// set the tunnel id on the outgoing message
|
|
||||||
nmsg.Header["Micro-Tunnel-Id"] = msg.id
|
|
||||||
|
|
||||||
// set the session id
|
|
||||||
nmsg.Header["Micro-Tunnel-Session"] = msg.session
|
|
||||||
|
|
||||||
// send the message via the interface
|
|
||||||
if err := t.link.Send(nmsg); err != nil {
|
|
||||||
// no op
|
|
||||||
// TODO: do something
|
|
||||||
}
|
|
||||||
case <-t.closed:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// process incoming messages
|
|
||||||
func (t *tun) listen() {
|
|
||||||
for {
|
|
||||||
// process anything via the net interface
|
|
||||||
msg := new(transport.Message)
|
|
||||||
err := t.link.Recv(msg)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// first check Micro-Tunnel
|
|
||||||
switch msg.Header["Micro-Tunnel"] {
|
|
||||||
case "connect":
|
|
||||||
// assuming new connection
|
|
||||||
// TODO: do something with this
|
|
||||||
continue
|
|
||||||
case "close":
|
|
||||||
// assuming connection closed
|
|
||||||
// TODO: do something with this
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// the tunnel id
|
|
||||||
id := msg.Header["Micro-Tunnel-Id"]
|
|
||||||
|
|
||||||
// the session id
|
|
||||||
session := msg.Header["Micro-Tunnel-Session"]
|
|
||||||
|
|
||||||
// if the session id is blank there's nothing we can do
|
|
||||||
// TODO: check this is the case, is there any reason
|
|
||||||
// why we'd have a blank session? Is the tunnel
|
|
||||||
// used for some other purpose?
|
|
||||||
if len(id) == 0 || len(session) == 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the socket based on the tunnel id and session
|
|
||||||
// this could be something we dialed in which case
|
|
||||||
// we have a session for it otherwise its a listener
|
|
||||||
s, exists := t.getSocket(id, session)
|
|
||||||
if !exists {
|
|
||||||
// try get it based on just the tunnel id
|
|
||||||
// the assumption here is that a listener
|
|
||||||
// has no session but its set a listener session
|
|
||||||
s, exists = t.getSocket(id, "listener")
|
|
||||||
if !exists {
|
|
||||||
// drop it, we don't care about
|
|
||||||
// messages we don't know about
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// is the socket closed?
|
|
||||||
select {
|
|
||||||
case <-s.closed:
|
|
||||||
// closed
|
|
||||||
delete(t.sockets, id)
|
|
||||||
continue
|
|
||||||
default:
|
|
||||||
// process
|
|
||||||
}
|
|
||||||
|
|
||||||
// is the socket new?
|
|
||||||
select {
|
|
||||||
// if its new the socket is actually blocked waiting
|
|
||||||
// for a connection. so we check if its waiting.
|
|
||||||
case <-s.wait:
|
|
||||||
// if its waiting e.g its new then we close it
|
|
||||||
default:
|
|
||||||
// set remote address of the socket
|
|
||||||
s.remote = msg.Header["Remote"]
|
|
||||||
close(s.wait)
|
|
||||||
}
|
|
||||||
|
|
||||||
// construct a new transport message
|
|
||||||
tmsg := &transport.Message{
|
|
||||||
Header: msg.Header,
|
|
||||||
Body: msg.Body,
|
|
||||||
}
|
|
||||||
|
|
||||||
// construct the internal message
|
|
||||||
imsg := &message{
|
|
||||||
id: id,
|
|
||||||
session: session,
|
|
||||||
data: tmsg,
|
|
||||||
}
|
|
||||||
|
|
||||||
// append to recv backlog
|
|
||||||
// we don't block if we can't pass it on
|
|
||||||
select {
|
|
||||||
case s.recv <- imsg:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *tun) connect() error {
|
|
||||||
return t.link.Send(&transport.Message{
|
|
||||||
Header: map[string]string{
|
|
||||||
"Micro-Tunnel": "connect",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *tun) close() error {
|
|
||||||
return t.link.Send(&transport.Message{
|
|
||||||
Header: map[string]string{
|
|
||||||
"Micro-Tunnel": "close",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Close the tunnel
|
|
||||||
func (t *tun) Close() error {
|
|
||||||
t.Lock()
|
|
||||||
defer t.Unlock()
|
|
||||||
|
|
||||||
if !t.connected {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
select {
|
|
||||||
case <-t.closed:
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
// close all the sockets
|
|
||||||
for _, s := range t.sockets {
|
|
||||||
s.Close()
|
|
||||||
}
|
|
||||||
// close the connection
|
|
||||||
close(t.closed)
|
|
||||||
t.connected = false
|
|
||||||
|
|
||||||
// send a close message
|
|
||||||
// we don't close the link
|
|
||||||
// just the tunnel
|
|
||||||
return t.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect the tunnel
|
|
||||||
func (t *tun) Connect() error {
|
|
||||||
t.Lock()
|
|
||||||
defer t.Unlock()
|
|
||||||
|
|
||||||
// already connected
|
|
||||||
if t.connected {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// send the connect message
|
|
||||||
if err := t.connect(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// set as connected
|
|
||||||
t.connected = true
|
|
||||||
// create new close channel
|
|
||||||
t.closed = make(chan bool)
|
|
||||||
|
|
||||||
// process messages to be sent
|
|
||||||
go t.process()
|
|
||||||
// process incoming messages
|
|
||||||
go t.listen()
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dial an address
|
|
||||||
func (t *tun) Dial(addr string) (Conn, error) {
|
|
||||||
c, ok := t.newSocket(addr, t.newSession())
|
|
||||||
if !ok {
|
|
||||||
return nil, errors.New("error dialing " + addr)
|
|
||||||
}
|
|
||||||
// set remote
|
|
||||||
c.remote = addr
|
|
||||||
// set local
|
|
||||||
c.local = t.link.Local()
|
|
||||||
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Accept a connection on the address
|
|
||||||
func (t *tun) Listen(addr string) (Listener, error) {
|
|
||||||
// create a new socket by hashing the address
|
|
||||||
c, ok := t.newSocket(addr, "listener")
|
|
||||||
if !ok {
|
|
||||||
return nil, errors.New("already listening on " + addr)
|
|
||||||
}
|
|
||||||
|
|
||||||
// set remote. it will be replaced by the first message received
|
|
||||||
c.remote = t.link.Remote()
|
|
||||||
// set local
|
|
||||||
c.local = addr
|
|
||||||
|
|
||||||
tl := &tunListener{
|
|
||||||
addr: addr,
|
|
||||||
// the accept channel
|
|
||||||
accept: make(chan *socket, 128),
|
|
||||||
// the channel to close
|
|
||||||
closed: make(chan bool),
|
|
||||||
// the connection
|
|
||||||
conn: c,
|
|
||||||
// the listener socket
|
|
||||||
socket: c,
|
|
||||||
}
|
|
||||||
|
|
||||||
// this kicks off the internal message processor
|
|
||||||
// for the listener so it can create pseudo sockets
|
|
||||||
// per session if they do not exist or pass messages
|
|
||||||
// to the existign sessions
|
|
||||||
go tl.process()
|
|
||||||
|
|
||||||
// return the listener
|
|
||||||
return tl, nil
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
package tunnel
|
|
||||||
|
|
||||||
import (
|
|
||||||
"io"
|
|
||||||
)
|
|
||||||
|
|
||||||
type tunListener struct {
|
|
||||||
// address of the listener
|
|
||||||
addr string
|
|
||||||
// the accept channel
|
|
||||||
accept chan *socket
|
|
||||||
// the channel to close
|
|
||||||
closed chan bool
|
|
||||||
// the connection
|
|
||||||
conn Conn
|
|
||||||
// the listener socket
|
|
||||||
socket *socket
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *tunListener) process() {
|
|
||||||
// our connection map for session
|
|
||||||
conns := make(map[string]*socket)
|
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-t.closed:
|
|
||||||
return
|
|
||||||
// receive a new message
|
|
||||||
case m := <-t.socket.recv:
|
|
||||||
// get a socket
|
|
||||||
sock, ok := conns[m.session]
|
|
||||||
if !ok {
|
|
||||||
// create a new socket session
|
|
||||||
sock = &socket{
|
|
||||||
// our tunnel id
|
|
||||||
id: m.id,
|
|
||||||
// the session id
|
|
||||||
session: m.session,
|
|
||||||
// close chan
|
|
||||||
closed: make(chan bool),
|
|
||||||
// recv called by the acceptor
|
|
||||||
recv: make(chan *message, 128),
|
|
||||||
// use the internal send buffer
|
|
||||||
send: t.socket.send,
|
|
||||||
// wait
|
|
||||||
wait: make(chan bool),
|
|
||||||
}
|
|
||||||
|
|
||||||
// first message
|
|
||||||
sock.recv <- m
|
|
||||||
|
|
||||||
// save the socket
|
|
||||||
conns[m.session] = sock
|
|
||||||
|
|
||||||
// send to accept chan
|
|
||||||
select {
|
|
||||||
case <-t.closed:
|
|
||||||
return
|
|
||||||
case t.accept <- sock:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// send this to the accept chan
|
|
||||||
select {
|
|
||||||
case <-sock.closed:
|
|
||||||
delete(conns, m.session)
|
|
||||||
case sock.recv <- m:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *tunListener) Addr() string {
|
|
||||||
return t.addr
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *tunListener) Close() error {
|
|
||||||
select {
|
|
||||||
case <-t.closed:
|
|
||||||
return nil
|
|
||||||
default:
|
|
||||||
close(t.closed)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Everytime accept is called we essentially block till we get a new connection
|
|
||||||
func (t *tunListener) Accept() (Conn, error) {
|
|
||||||
select {
|
|
||||||
// if the socket is closed return
|
|
||||||
case <-t.closed:
|
|
||||||
return nil, io.EOF
|
|
||||||
// wait for a new connection
|
|
||||||
case c, ok := <-t.accept:
|
|
||||||
if !ok {
|
|
||||||
return nil, io.EOF
|
|
||||||
}
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
@ -1,90 +0,0 @@
|
|||||||
package tunnel
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
|
|
||||||
"github.com/micro/go-micro/transport"
|
|
||||||
)
|
|
||||||
|
|
||||||
// socket is our pseudo socket for transport.Socket
|
|
||||||
type socket struct {
|
|
||||||
// socket id based on Micro-Tunnel
|
|
||||||
id string
|
|
||||||
// the session id based on Micro.Tunnel-Session
|
|
||||||
session string
|
|
||||||
// closed
|
|
||||||
closed chan bool
|
|
||||||
// remote addr
|
|
||||||
remote string
|
|
||||||
// local addr
|
|
||||||
local string
|
|
||||||
// send chan
|
|
||||||
send chan *message
|
|
||||||
// recv chan
|
|
||||||
recv chan *message
|
|
||||||
// wait until we have a connection
|
|
||||||
wait chan bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// message is sent over the send channel
|
|
||||||
type message struct {
|
|
||||||
// tunnel id
|
|
||||||
id string
|
|
||||||
// the session id
|
|
||||||
session string
|
|
||||||
// transport data
|
|
||||||
data *transport.Message
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *socket) Remote() string {
|
|
||||||
return s.remote
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *socket) Local() string {
|
|
||||||
return s.local
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *socket) Id() string {
|
|
||||||
return s.id
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *socket) Session() string {
|
|
||||||
return s.session
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *socket) Send(m *transport.Message) error {
|
|
||||||
select {
|
|
||||||
case <-s.closed:
|
|
||||||
return errors.New("socket is closed")
|
|
||||||
default:
|
|
||||||
// no op
|
|
||||||
}
|
|
||||||
// append to backlog
|
|
||||||
s.send <- &message{id: s.id, session: s.session, data: m}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *socket) Recv(m *transport.Message) error {
|
|
||||||
select {
|
|
||||||
case <-s.closed:
|
|
||||||
return errors.New("socket is closed")
|
|
||||||
default:
|
|
||||||
// no op
|
|
||||||
}
|
|
||||||
// recv from backlog
|
|
||||||
msg := <-s.recv
|
|
||||||
// set message
|
|
||||||
*m = *msg.data
|
|
||||||
// return nil
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *socket) Close() error {
|
|
||||||
select {
|
|
||||||
case <-s.closed:
|
|
||||||
// no op
|
|
||||||
default:
|
|
||||||
close(s.closed)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
// Package tunnel provides gre network tunnelling
|
|
||||||
package tunnel
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/micro/go-micro/network/link"
|
|
||||||
"github.com/micro/go-micro/transport"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Tunnel creates a gre network tunnel on top of a link.
|
|
||||||
// It establishes multiple streams using the Micro-Tunnel-Id header
|
|
||||||
// and Micro-Tunnel-Session header. The tunnel id is a hash of
|
|
||||||
// the address being requested.
|
|
||||||
type Tunnel interface {
|
|
||||||
// Connect connects the tunnel
|
|
||||||
Connect() error
|
|
||||||
// Close closes the tunnel
|
|
||||||
Close() error
|
|
||||||
// Dial an endpoint
|
|
||||||
Dial(addr string) (Conn, error)
|
|
||||||
// Accept connections
|
|
||||||
Listen(addr string) (Listener, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// The listener provides similar constructs to the transport.Listener
|
|
||||||
type Listener interface {
|
|
||||||
Addr() string
|
|
||||||
Close() error
|
|
||||||
Accept() (Conn, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Conn is a connection dialed or accepted which includes the tunnel id and session
|
|
||||||
type Conn interface {
|
|
||||||
// Specifies the tunnel id
|
|
||||||
Id() string
|
|
||||||
// The session
|
|
||||||
Session() string
|
|
||||||
// a transport socket
|
|
||||||
transport.Socket
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewTunnel creates a new tunnel on top of a link
|
|
||||||
func NewTunnel(l link.Link) Tunnel {
|
|
||||||
return newTunnel(l)
|
|
||||||
}
|
|
@ -1,113 +0,0 @@
|
|||||||
package tunnel
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/micro/go-micro/network/link"
|
|
||||||
"github.com/micro/go-micro/transport"
|
|
||||||
)
|
|
||||||
|
|
||||||
// testAccept will accept connections on the transport, create a new link and tunnel on top
|
|
||||||
func testAccept(t *testing.T, l transport.Listener, wait chan bool) error {
|
|
||||||
// accept new connections on the transport
|
|
||||||
// establish a link and tunnel
|
|
||||||
return l.Accept(func(s transport.Socket) {
|
|
||||||
// convert the socket into a link
|
|
||||||
li := link.NewLink(
|
|
||||||
link.Socket(s),
|
|
||||||
)
|
|
||||||
|
|
||||||
// connect the link e.g start internal buffers
|
|
||||||
if err := li.Connect(); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a new tunnel
|
|
||||||
tun := NewTunnel(li)
|
|
||||||
|
|
||||||
// connect the tunnel
|
|
||||||
if err := tun.Connect(); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// listen on some virtual address
|
|
||||||
tl, err := tun.Listen("test-tunnel")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// accept a connection
|
|
||||||
c, err := tl.Accept()
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// get a message
|
|
||||||
for {
|
|
||||||
m := new(transport.Message)
|
|
||||||
if err := c.Recv(m); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
close(wait)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// testSend will create a new link to an address and then a tunnel on top
|
|
||||||
func testSend(t *testing.T, addr string) {
|
|
||||||
// create a new link
|
|
||||||
l := link.NewLink(
|
|
||||||
link.Address(addr),
|
|
||||||
)
|
|
||||||
|
|
||||||
// connect the link, this includes dialing
|
|
||||||
if err := l.Connect(); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// create a tunnel on the link
|
|
||||||
tun := NewTunnel(l)
|
|
||||||
|
|
||||||
// connect the tunnel with the remote side
|
|
||||||
if err := tun.Connect(); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// dial a new session
|
|
||||||
c, err := tun.Dial("test-tunnel")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
m := transport.Message{
|
|
||||||
Header: map[string]string{
|
|
||||||
"test": "header",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
if err := c.Send(&m); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestTunnel(t *testing.T) {
|
|
||||||
// create a new listener
|
|
||||||
tr := transport.NewTransport()
|
|
||||||
l, err := tr.Listen(":0")
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer l.Close()
|
|
||||||
|
|
||||||
wait := make(chan bool)
|
|
||||||
|
|
||||||
// start accepting connections
|
|
||||||
go testAccept(t, l, wait)
|
|
||||||
|
|
||||||
// send a message
|
|
||||||
testSend(t, l.Addr())
|
|
||||||
|
|
||||||
// wait until message is received
|
|
||||||
<-wait
|
|
||||||
}
|
|
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/micro/go-micro/client/grpc"
|
"github.com/micro/go-micro/client/grpc"
|
||||||
"github.com/micro/go-micro/codec"
|
"github.com/micro/go-micro/codec"
|
||||||
"github.com/micro/go-micro/config/options"
|
"github.com/micro/go-micro/config/options"
|
||||||
"github.com/micro/go-micro/network/proxy"
|
"github.com/micro/go-micro/proxy"
|
||||||
"github.com/micro/go-micro/server"
|
"github.com/micro/go-micro/server"
|
||||||
)
|
)
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"github.com/micro/go-micro/config/options"
|
"github.com/micro/go-micro/config/options"
|
||||||
"github.com/micro/go-micro/errors"
|
"github.com/micro/go-micro/errors"
|
||||||
"github.com/micro/go-micro/network/proxy"
|
"github.com/micro/go-micro/proxy"
|
||||||
"github.com/micro/go-micro/server"
|
"github.com/micro/go-micro/server"
|
||||||
)
|
)
|
||||||
|
|
@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/micro/go-micro/codec"
|
"github.com/micro/go-micro/codec"
|
||||||
"github.com/micro/go-micro/codec/bytes"
|
"github.com/micro/go-micro/codec/bytes"
|
||||||
"github.com/micro/go-micro/config/options"
|
"github.com/micro/go-micro/config/options"
|
||||||
"github.com/micro/go-micro/network/proxy"
|
"github.com/micro/go-micro/proxy"
|
||||||
"github.com/micro/go-micro/network/router"
|
"github.com/micro/go-micro/router"
|
||||||
"github.com/micro/go-micro/server"
|
"github.com/micro/go-micro/server"
|
||||||
)
|
)
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/micro/go-micro/client"
|
"github.com/micro/go-micro/client"
|
||||||
"github.com/micro/go-micro/config/options"
|
"github.com/micro/go-micro/config/options"
|
||||||
"github.com/micro/go-micro/network/router"
|
"github.com/micro/go-micro/router"
|
||||||
"github.com/micro/go-micro/server"
|
"github.com/micro/go-micro/server"
|
||||||
)
|
)
|
||||||
|
|
@ -6,8 +6,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/micro/go-micro/errors"
|
"github.com/micro/go-micro/errors"
|
||||||
"github.com/micro/go-micro/network/router"
|
"github.com/micro/go-micro/router"
|
||||||
pb "github.com/micro/go-micro/network/router/proto"
|
pb "github.com/micro/go-micro/router/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Router implements router handler
|
// Router implements router handler
|
@ -4,8 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/micro/go-micro/errors"
|
"github.com/micro/go-micro/errors"
|
||||||
"github.com/micro/go-micro/network/router"
|
"github.com/micro/go-micro/router"
|
||||||
pb "github.com/micro/go-micro/network/router/proto"
|
pb "github.com/micro/go-micro/router/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Table struct {
|
type Table struct {
|
@ -1,5 +1,5 @@
|
|||||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||||
// source: go-micro/network/router/proto/router.proto
|
// source: micro/go-micro/router/proto/router.proto
|
||||||
|
|
||||||
package go_micro_router
|
package go_micro_router
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ var _ server.Option
|
|||||||
type RouterService interface {
|
type RouterService interface {
|
||||||
Lookup(ctx context.Context, in *LookupRequest, opts ...client.CallOption) (*LookupResponse, error)
|
Lookup(ctx context.Context, in *LookupRequest, opts ...client.CallOption) (*LookupResponse, error)
|
||||||
Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Router_WatchService, error)
|
Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Router_WatchService, error)
|
||||||
Advertise(ctx context.Context, in *AdvertiseRequest, opts ...client.CallOption) (Router_AdvertiseService, error)
|
Advertise(ctx context.Context, in *Request, opts ...client.CallOption) (Router_AdvertiseService, error)
|
||||||
Process(ctx context.Context, in *Advert, opts ...client.CallOption) (*ProcessResponse, error)
|
Process(ctx context.Context, in *Advert, opts ...client.CallOption) (*ProcessResponse, error)
|
||||||
Status(ctx context.Context, in *Request, opts ...client.CallOption) (*StatusResponse, error)
|
Status(ctx context.Context, in *Request, opts ...client.CallOption) (*StatusResponse, error)
|
||||||
}
|
}
|
||||||
@ -113,8 +113,8 @@ func (x *routerServiceWatch) Recv() (*Event, error) {
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *routerService) Advertise(ctx context.Context, in *AdvertiseRequest, opts ...client.CallOption) (Router_AdvertiseService, error) {
|
func (c *routerService) Advertise(ctx context.Context, in *Request, opts ...client.CallOption) (Router_AdvertiseService, error) {
|
||||||
req := c.c.NewRequest(c.name, "Router.Advertise", &AdvertiseRequest{})
|
req := c.c.NewRequest(c.name, "Router.Advertise", &Request{})
|
||||||
stream, err := c.c.Stream(ctx, req, opts...)
|
stream, err := c.c.Stream(ctx, req, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -182,7 +182,7 @@ func (c *routerService) Status(ctx context.Context, in *Request, opts ...client.
|
|||||||
type RouterHandler interface {
|
type RouterHandler interface {
|
||||||
Lookup(context.Context, *LookupRequest, *LookupResponse) error
|
Lookup(context.Context, *LookupRequest, *LookupResponse) error
|
||||||
Watch(context.Context, *WatchRequest, Router_WatchStream) error
|
Watch(context.Context, *WatchRequest, Router_WatchStream) error
|
||||||
Advertise(context.Context, *AdvertiseRequest, Router_AdvertiseStream) error
|
Advertise(context.Context, *Request, Router_AdvertiseStream) error
|
||||||
Process(context.Context, *Advert, *ProcessResponse) error
|
Process(context.Context, *Advert, *ProcessResponse) error
|
||||||
Status(context.Context, *Request, *StatusResponse) error
|
Status(context.Context, *Request, *StatusResponse) error
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ func (x *routerWatchStream) Send(m *Event) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *routerHandler) Advertise(ctx context.Context, stream server.Stream) error {
|
func (h *routerHandler) Advertise(ctx context.Context, stream server.Stream) error {
|
||||||
m := new(AdvertiseRequest)
|
m := new(Request)
|
||||||
if err := stream.Recv(m); err != nil {
|
if err := stream.Recv(m); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -294,8 +294,8 @@ type TableService interface {
|
|||||||
Create(ctx context.Context, in *Route, opts ...client.CallOption) (*CreateResponse, error)
|
Create(ctx context.Context, in *Route, opts ...client.CallOption) (*CreateResponse, error)
|
||||||
Delete(ctx context.Context, in *Route, opts ...client.CallOption) (*DeleteResponse, error)
|
Delete(ctx context.Context, in *Route, opts ...client.CallOption) (*DeleteResponse, error)
|
||||||
Update(ctx context.Context, in *Route, opts ...client.CallOption) (*UpdateResponse, error)
|
Update(ctx context.Context, in *Route, opts ...client.CallOption) (*UpdateResponse, error)
|
||||||
Query(ctx context.Context, in *QueryRequest, opts ...client.CallOption) (*QueryResponse, error)
|
|
||||||
List(ctx context.Context, in *Request, opts ...client.CallOption) (*ListResponse, error)
|
List(ctx context.Context, in *Request, opts ...client.CallOption) (*ListResponse, error)
|
||||||
|
Query(ctx context.Context, in *QueryRequest, opts ...client.CallOption) (*QueryResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type tableService struct {
|
type tableService struct {
|
||||||
@ -346,9 +346,9 @@ func (c *tableService) Update(ctx context.Context, in *Route, opts ...client.Cal
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *tableService) Query(ctx context.Context, in *QueryRequest, opts ...client.CallOption) (*QueryResponse, error) {
|
func (c *tableService) List(ctx context.Context, in *Request, opts ...client.CallOption) (*ListResponse, error) {
|
||||||
req := c.c.NewRequest(c.name, "Table.Query", in)
|
req := c.c.NewRequest(c.name, "Table.List", in)
|
||||||
out := new(QueryResponse)
|
out := new(ListResponse)
|
||||||
err := c.c.Call(ctx, req, out, opts...)
|
err := c.c.Call(ctx, req, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -356,9 +356,9 @@ func (c *tableService) Query(ctx context.Context, in *QueryRequest, opts ...clie
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *tableService) List(ctx context.Context, in *Request, opts ...client.CallOption) (*ListResponse, error) {
|
func (c *tableService) Query(ctx context.Context, in *QueryRequest, opts ...client.CallOption) (*QueryResponse, error) {
|
||||||
req := c.c.NewRequest(c.name, "Table.List", in)
|
req := c.c.NewRequest(c.name, "Table.Query", in)
|
||||||
out := new(ListResponse)
|
out := new(QueryResponse)
|
||||||
err := c.c.Call(ctx, req, out, opts...)
|
err := c.c.Call(ctx, req, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -372,8 +372,8 @@ type TableHandler interface {
|
|||||||
Create(context.Context, *Route, *CreateResponse) error
|
Create(context.Context, *Route, *CreateResponse) error
|
||||||
Delete(context.Context, *Route, *DeleteResponse) error
|
Delete(context.Context, *Route, *DeleteResponse) error
|
||||||
Update(context.Context, *Route, *UpdateResponse) error
|
Update(context.Context, *Route, *UpdateResponse) error
|
||||||
Query(context.Context, *QueryRequest, *QueryResponse) error
|
|
||||||
List(context.Context, *Request, *ListResponse) error
|
List(context.Context, *Request, *ListResponse) error
|
||||||
|
Query(context.Context, *QueryRequest, *QueryResponse) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterTableHandler(s server.Server, hdlr TableHandler, opts ...server.HandlerOption) error {
|
func RegisterTableHandler(s server.Server, hdlr TableHandler, opts ...server.HandlerOption) error {
|
||||||
@ -381,8 +381,8 @@ func RegisterTableHandler(s server.Server, hdlr TableHandler, opts ...server.Han
|
|||||||
Create(ctx context.Context, in *Route, out *CreateResponse) error
|
Create(ctx context.Context, in *Route, out *CreateResponse) error
|
||||||
Delete(ctx context.Context, in *Route, out *DeleteResponse) error
|
Delete(ctx context.Context, in *Route, out *DeleteResponse) error
|
||||||
Update(ctx context.Context, in *Route, out *UpdateResponse) error
|
Update(ctx context.Context, in *Route, out *UpdateResponse) error
|
||||||
Query(ctx context.Context, in *QueryRequest, out *QueryResponse) error
|
|
||||||
List(ctx context.Context, in *Request, out *ListResponse) error
|
List(ctx context.Context, in *Request, out *ListResponse) error
|
||||||
|
Query(ctx context.Context, in *QueryRequest, out *QueryResponse) error
|
||||||
}
|
}
|
||||||
type Table struct {
|
type Table struct {
|
||||||
table
|
table
|
||||||
@ -407,10 +407,10 @@ func (h *tableHandler) Update(ctx context.Context, in *Route, out *UpdateRespons
|
|||||||
return h.TableHandler.Update(ctx, in, out)
|
return h.TableHandler.Update(ctx, in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *tableHandler) Query(ctx context.Context, in *QueryRequest, out *QueryResponse) error {
|
|
||||||
return h.TableHandler.Query(ctx, in, out)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *tableHandler) List(ctx context.Context, in *Request, out *ListResponse) error {
|
func (h *tableHandler) List(ctx context.Context, in *Request, out *ListResponse) error {
|
||||||
return h.TableHandler.List(ctx, in, out)
|
return h.TableHandler.List(ctx, in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *tableHandler) Query(ctx context.Context, in *QueryRequest, out *QueryResponse) error {
|
||||||
|
return h.TableHandler.Query(ctx, in, out)
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// source: go-micro/network/router/proto/router.proto
|
// source: micro/go-micro/router/proto/router.proto
|
||||||
|
|
||||||
package go_micro_router
|
package go_micro_router
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ func (x AdvertType) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (AdvertType) EnumDescriptor() ([]byte, []int) {
|
func (AdvertType) EnumDescriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{0}
|
return fileDescriptor_6a36eee0b1adf739, []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
// EventType defines the type of event
|
// EventType defines the type of event
|
||||||
@ -74,7 +74,7 @@ func (x EventType) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (EventType) EnumDescriptor() ([]byte, []int) {
|
func (EventType) EnumDescriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{1}
|
return fileDescriptor_6a36eee0b1adf739, []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty request
|
// Empty request
|
||||||
@ -88,7 +88,7 @@ func (m *Request) Reset() { *m = Request{} }
|
|||||||
func (m *Request) String() string { return proto.CompactTextString(m) }
|
func (m *Request) String() string { return proto.CompactTextString(m) }
|
||||||
func (*Request) ProtoMessage() {}
|
func (*Request) ProtoMessage() {}
|
||||||
func (*Request) Descriptor() ([]byte, []int) {
|
func (*Request) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{0}
|
return fileDescriptor_6a36eee0b1adf739, []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Request) XXX_Unmarshal(b []byte) error {
|
func (m *Request) XXX_Unmarshal(b []byte) error {
|
||||||
@ -121,7 +121,7 @@ func (m *ListResponse) Reset() { *m = ListResponse{} }
|
|||||||
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
|
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*ListResponse) ProtoMessage() {}
|
func (*ListResponse) ProtoMessage() {}
|
||||||
func (*ListResponse) Descriptor() ([]byte, []int) {
|
func (*ListResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{1}
|
return fileDescriptor_6a36eee0b1adf739, []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
|
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
|
||||||
@ -161,7 +161,7 @@ func (m *LookupRequest) Reset() { *m = LookupRequest{} }
|
|||||||
func (m *LookupRequest) String() string { return proto.CompactTextString(m) }
|
func (m *LookupRequest) String() string { return proto.CompactTextString(m) }
|
||||||
func (*LookupRequest) ProtoMessage() {}
|
func (*LookupRequest) ProtoMessage() {}
|
||||||
func (*LookupRequest) Descriptor() ([]byte, []int) {
|
func (*LookupRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{2}
|
return fileDescriptor_6a36eee0b1adf739, []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *LookupRequest) XXX_Unmarshal(b []byte) error {
|
func (m *LookupRequest) XXX_Unmarshal(b []byte) error {
|
||||||
@ -201,7 +201,7 @@ func (m *LookupResponse) Reset() { *m = LookupResponse{} }
|
|||||||
func (m *LookupResponse) String() string { return proto.CompactTextString(m) }
|
func (m *LookupResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*LookupResponse) ProtoMessage() {}
|
func (*LookupResponse) ProtoMessage() {}
|
||||||
func (*LookupResponse) Descriptor() ([]byte, []int) {
|
func (*LookupResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{3}
|
return fileDescriptor_6a36eee0b1adf739, []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *LookupResponse) XXX_Unmarshal(b []byte) error {
|
func (m *LookupResponse) XXX_Unmarshal(b []byte) error {
|
||||||
@ -240,7 +240,7 @@ func (m *QueryRequest) Reset() { *m = QueryRequest{} }
|
|||||||
func (m *QueryRequest) String() string { return proto.CompactTextString(m) }
|
func (m *QueryRequest) String() string { return proto.CompactTextString(m) }
|
||||||
func (*QueryRequest) ProtoMessage() {}
|
func (*QueryRequest) ProtoMessage() {}
|
||||||
func (*QueryRequest) Descriptor() ([]byte, []int) {
|
func (*QueryRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{4}
|
return fileDescriptor_6a36eee0b1adf739, []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryRequest) XXX_Unmarshal(b []byte) error {
|
func (m *QueryRequest) XXX_Unmarshal(b []byte) error {
|
||||||
@ -279,7 +279,7 @@ func (m *QueryResponse) Reset() { *m = QueryResponse{} }
|
|||||||
func (m *QueryResponse) String() string { return proto.CompactTextString(m) }
|
func (m *QueryResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*QueryResponse) ProtoMessage() {}
|
func (*QueryResponse) ProtoMessage() {}
|
||||||
func (*QueryResponse) Descriptor() ([]byte, []int) {
|
func (*QueryResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{5}
|
return fileDescriptor_6a36eee0b1adf739, []int{5}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *QueryResponse) XXX_Unmarshal(b []byte) error {
|
func (m *QueryResponse) XXX_Unmarshal(b []byte) error {
|
||||||
@ -318,7 +318,7 @@ func (m *WatchRequest) Reset() { *m = WatchRequest{} }
|
|||||||
func (m *WatchRequest) String() string { return proto.CompactTextString(m) }
|
func (m *WatchRequest) String() string { return proto.CompactTextString(m) }
|
||||||
func (*WatchRequest) ProtoMessage() {}
|
func (*WatchRequest) ProtoMessage() {}
|
||||||
func (*WatchRequest) Descriptor() ([]byte, []int) {
|
func (*WatchRequest) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{6}
|
return fileDescriptor_6a36eee0b1adf739, []int{6}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *WatchRequest) XXX_Unmarshal(b []byte) error {
|
func (m *WatchRequest) XXX_Unmarshal(b []byte) error {
|
||||||
@ -339,38 +339,6 @@ func (m *WatchRequest) XXX_DiscardUnknown() {
|
|||||||
|
|
||||||
var xxx_messageInfo_WatchRequest proto.InternalMessageInfo
|
var xxx_messageInfo_WatchRequest proto.InternalMessageInfo
|
||||||
|
|
||||||
// AdvertiseRequest request a stream of Adverts
|
|
||||||
type AdvertiseRequest struct {
|
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
||||||
XXX_unrecognized []byte `json:"-"`
|
|
||||||
XXX_sizecache int32 `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *AdvertiseRequest) Reset() { *m = AdvertiseRequest{} }
|
|
||||||
func (m *AdvertiseRequest) String() string { return proto.CompactTextString(m) }
|
|
||||||
func (*AdvertiseRequest) ProtoMessage() {}
|
|
||||||
func (*AdvertiseRequest) Descriptor() ([]byte, []int) {
|
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{7}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *AdvertiseRequest) XXX_Unmarshal(b []byte) error {
|
|
||||||
return xxx_messageInfo_AdvertiseRequest.Unmarshal(m, b)
|
|
||||||
}
|
|
||||||
func (m *AdvertiseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
||||||
return xxx_messageInfo_AdvertiseRequest.Marshal(b, m, deterministic)
|
|
||||||
}
|
|
||||||
func (m *AdvertiseRequest) XXX_Merge(src proto.Message) {
|
|
||||||
xxx_messageInfo_AdvertiseRequest.Merge(m, src)
|
|
||||||
}
|
|
||||||
func (m *AdvertiseRequest) XXX_Size() int {
|
|
||||||
return xxx_messageInfo_AdvertiseRequest.Size(m)
|
|
||||||
}
|
|
||||||
func (m *AdvertiseRequest) XXX_DiscardUnknown() {
|
|
||||||
xxx_messageInfo_AdvertiseRequest.DiscardUnknown(m)
|
|
||||||
}
|
|
||||||
|
|
||||||
var xxx_messageInfo_AdvertiseRequest proto.InternalMessageInfo
|
|
||||||
|
|
||||||
// Advert is router advertsement streamed by Watch
|
// Advert is router advertsement streamed by Watch
|
||||||
type Advert struct {
|
type Advert struct {
|
||||||
// id of the advertising router
|
// id of the advertising router
|
||||||
@ -392,7 +360,7 @@ func (m *Advert) Reset() { *m = Advert{} }
|
|||||||
func (m *Advert) String() string { return proto.CompactTextString(m) }
|
func (m *Advert) String() string { return proto.CompactTextString(m) }
|
||||||
func (*Advert) ProtoMessage() {}
|
func (*Advert) ProtoMessage() {}
|
||||||
func (*Advert) Descriptor() ([]byte, []int) {
|
func (*Advert) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{8}
|
return fileDescriptor_6a36eee0b1adf739, []int{7}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Advert) XXX_Unmarshal(b []byte) error {
|
func (m *Advert) XXX_Unmarshal(b []byte) error {
|
||||||
@ -459,7 +427,7 @@ func (m *ProcessResponse) Reset() { *m = ProcessResponse{} }
|
|||||||
func (m *ProcessResponse) String() string { return proto.CompactTextString(m) }
|
func (m *ProcessResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*ProcessResponse) ProtoMessage() {}
|
func (*ProcessResponse) ProtoMessage() {}
|
||||||
func (*ProcessResponse) Descriptor() ([]byte, []int) {
|
func (*ProcessResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{9}
|
return fileDescriptor_6a36eee0b1adf739, []int{8}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ProcessResponse) XXX_Unmarshal(b []byte) error {
|
func (m *ProcessResponse) XXX_Unmarshal(b []byte) error {
|
||||||
@ -491,7 +459,7 @@ func (m *CreateResponse) Reset() { *m = CreateResponse{} }
|
|||||||
func (m *CreateResponse) String() string { return proto.CompactTextString(m) }
|
func (m *CreateResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*CreateResponse) ProtoMessage() {}
|
func (*CreateResponse) ProtoMessage() {}
|
||||||
func (*CreateResponse) Descriptor() ([]byte, []int) {
|
func (*CreateResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{10}
|
return fileDescriptor_6a36eee0b1adf739, []int{9}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *CreateResponse) XXX_Unmarshal(b []byte) error {
|
func (m *CreateResponse) XXX_Unmarshal(b []byte) error {
|
||||||
@ -523,7 +491,7 @@ func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
|
|||||||
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
|
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DeleteResponse) ProtoMessage() {}
|
func (*DeleteResponse) ProtoMessage() {}
|
||||||
func (*DeleteResponse) Descriptor() ([]byte, []int) {
|
func (*DeleteResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{11}
|
return fileDescriptor_6a36eee0b1adf739, []int{10}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
|
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
|
||||||
@ -555,7 +523,7 @@ func (m *UpdateResponse) Reset() { *m = UpdateResponse{} }
|
|||||||
func (m *UpdateResponse) String() string { return proto.CompactTextString(m) }
|
func (m *UpdateResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*UpdateResponse) ProtoMessage() {}
|
func (*UpdateResponse) ProtoMessage() {}
|
||||||
func (*UpdateResponse) Descriptor() ([]byte, []int) {
|
func (*UpdateResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{12}
|
return fileDescriptor_6a36eee0b1adf739, []int{11}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *UpdateResponse) XXX_Unmarshal(b []byte) error {
|
func (m *UpdateResponse) XXX_Unmarshal(b []byte) error {
|
||||||
@ -593,7 +561,7 @@ func (m *Event) Reset() { *m = Event{} }
|
|||||||
func (m *Event) String() string { return proto.CompactTextString(m) }
|
func (m *Event) String() string { return proto.CompactTextString(m) }
|
||||||
func (*Event) ProtoMessage() {}
|
func (*Event) ProtoMessage() {}
|
||||||
func (*Event) Descriptor() ([]byte, []int) {
|
func (*Event) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{13}
|
return fileDescriptor_6a36eee0b1adf739, []int{12}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Event) XXX_Unmarshal(b []byte) error {
|
func (m *Event) XXX_Unmarshal(b []byte) error {
|
||||||
@ -652,7 +620,7 @@ func (m *Query) Reset() { *m = Query{} }
|
|||||||
func (m *Query) String() string { return proto.CompactTextString(m) }
|
func (m *Query) String() string { return proto.CompactTextString(m) }
|
||||||
func (*Query) ProtoMessage() {}
|
func (*Query) ProtoMessage() {}
|
||||||
func (*Query) Descriptor() ([]byte, []int) {
|
func (*Query) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{14}
|
return fileDescriptor_6a36eee0b1adf739, []int{13}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Query) XXX_Unmarshal(b []byte) error {
|
func (m *Query) XXX_Unmarshal(b []byte) error {
|
||||||
@ -717,7 +685,7 @@ func (m *Route) Reset() { *m = Route{} }
|
|||||||
func (m *Route) String() string { return proto.CompactTextString(m) }
|
func (m *Route) String() string { return proto.CompactTextString(m) }
|
||||||
func (*Route) ProtoMessage() {}
|
func (*Route) ProtoMessage() {}
|
||||||
func (*Route) Descriptor() ([]byte, []int) {
|
func (*Route) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{15}
|
return fileDescriptor_6a36eee0b1adf739, []int{14}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Route) XXX_Unmarshal(b []byte) error {
|
func (m *Route) XXX_Unmarshal(b []byte) error {
|
||||||
@ -792,7 +760,7 @@ func (m *Status) Reset() { *m = Status{} }
|
|||||||
func (m *Status) String() string { return proto.CompactTextString(m) }
|
func (m *Status) String() string { return proto.CompactTextString(m) }
|
||||||
func (*Status) ProtoMessage() {}
|
func (*Status) ProtoMessage() {}
|
||||||
func (*Status) Descriptor() ([]byte, []int) {
|
func (*Status) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{16}
|
return fileDescriptor_6a36eee0b1adf739, []int{15}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Status) XXX_Unmarshal(b []byte) error {
|
func (m *Status) XXX_Unmarshal(b []byte) error {
|
||||||
@ -838,7 +806,7 @@ func (m *StatusResponse) Reset() { *m = StatusResponse{} }
|
|||||||
func (m *StatusResponse) String() string { return proto.CompactTextString(m) }
|
func (m *StatusResponse) String() string { return proto.CompactTextString(m) }
|
||||||
func (*StatusResponse) ProtoMessage() {}
|
func (*StatusResponse) ProtoMessage() {}
|
||||||
func (*StatusResponse) Descriptor() ([]byte, []int) {
|
func (*StatusResponse) Descriptor() ([]byte, []int) {
|
||||||
return fileDescriptor_fc08514fc6dadd29, []int{17}
|
return fileDescriptor_6a36eee0b1adf739, []int{16}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *StatusResponse) XXX_Unmarshal(b []byte) error {
|
func (m *StatusResponse) XXX_Unmarshal(b []byte) error {
|
||||||
@ -876,7 +844,6 @@ func init() {
|
|||||||
proto.RegisterType((*QueryRequest)(nil), "go.micro.router.QueryRequest")
|
proto.RegisterType((*QueryRequest)(nil), "go.micro.router.QueryRequest")
|
||||||
proto.RegisterType((*QueryResponse)(nil), "go.micro.router.QueryResponse")
|
proto.RegisterType((*QueryResponse)(nil), "go.micro.router.QueryResponse")
|
||||||
proto.RegisterType((*WatchRequest)(nil), "go.micro.router.WatchRequest")
|
proto.RegisterType((*WatchRequest)(nil), "go.micro.router.WatchRequest")
|
||||||
proto.RegisterType((*AdvertiseRequest)(nil), "go.micro.router.AdvertiseRequest")
|
|
||||||
proto.RegisterType((*Advert)(nil), "go.micro.router.Advert")
|
proto.RegisterType((*Advert)(nil), "go.micro.router.Advert")
|
||||||
proto.RegisterType((*ProcessResponse)(nil), "go.micro.router.ProcessResponse")
|
proto.RegisterType((*ProcessResponse)(nil), "go.micro.router.ProcessResponse")
|
||||||
proto.RegisterType((*CreateResponse)(nil), "go.micro.router.CreateResponse")
|
proto.RegisterType((*CreateResponse)(nil), "go.micro.router.CreateResponse")
|
||||||
@ -890,55 +857,55 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterFile("go-micro/network/router/proto/router.proto", fileDescriptor_fc08514fc6dadd29)
|
proto.RegisterFile("micro/go-micro/router/proto/router.proto", fileDescriptor_6a36eee0b1adf739)
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileDescriptor_fc08514fc6dadd29 = []byte{
|
var fileDescriptor_6a36eee0b1adf739 = []byte{
|
||||||
// 702 bytes of a gzipped FileDescriptorProto
|
// 689 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcd, 0x4e, 0xdb, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcd, 0x4e, 0xdb, 0x40,
|
||||||
0x10, 0xb6, 0x93, 0xd8, 0xc8, 0xd3, 0x60, 0xdc, 0x51, 0x05, 0x56, 0x5a, 0x68, 0xea, 0x13, 0x42,
|
0x10, 0xb6, 0x93, 0xd8, 0x28, 0xd3, 0x10, 0xdc, 0x51, 0x05, 0x56, 0x5a, 0x20, 0xf2, 0x29, 0x42,
|
||||||
0xd4, 0xa9, 0xd2, 0x6b, 0xff, 0x52, 0x4a, 0x55, 0x09, 0x0e, 0xad, 0x0b, 0xea, 0xd9, 0xd8, 0x2b,
|
0xd4, 0xa9, 0xd2, 0x6b, 0xff, 0x02, 0xa5, 0xaa, 0x54, 0x0e, 0xad, 0x0b, 0xea, 0xd9, 0xd8, 0x23,
|
||||||
0x6a, 0x91, 0x78, 0xcd, 0xee, 0x06, 0x94, 0x73, 0x1f, 0xa3, 0x4f, 0xd0, 0xe7, 0xea, 0x33, 0xf4,
|
0x6a, 0x91, 0xd8, 0x66, 0x77, 0x03, 0xca, 0xb9, 0x8f, 0xd1, 0x27, 0xe8, 0x73, 0xf5, 0xda, 0x87,
|
||||||
0x5e, 0x79, 0x77, 0x1d, 0x92, 0x18, 0x23, 0xc1, 0xc9, 0x3b, 0x7f, 0xdf, 0xec, 0xcc, 0xce, 0x37,
|
0xa8, 0xbc, 0xbb, 0x0e, 0x21, 0xc6, 0x48, 0x70, 0xf2, 0xce, 0xdf, 0x37, 0xff, 0x63, 0x18, 0x4c,
|
||||||
0x86, 0xbd, 0x73, 0xfa, 0x72, 0x92, 0x25, 0x8c, 0x0e, 0x72, 0x22, 0xae, 0x29, 0xbb, 0x18, 0x30,
|
0x93, 0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 0xdc, 0x30, 0xd0, 0x81, 0xa6, 0x10, 0x13, 0xb7, 0x25, 0xf9, 0xc5, 0xb3, 0x88, 0x9d,
|
||||||
0x47, 0x37, 0x0a, 0xf4, 0xa0, 0x2d, 0xc4, 0xd8, 0xef, 0x48, 0x7d, 0x79, 0x2c, 0xeb, 0x21, 0x57,
|
0xae, 0x28, 0x15, 0xdc, 0xb5, 0x6a, 0x62, 0x3f, 0x2a, 0xc4, 0x81, 0xd6, 0xf2, 0x9e, 0xc2, 0xc6,
|
||||||
0x24, 0x17, 0xdc, 0xb7, 0x1a, 0xea, 0x39, 0x2c, 0xcd, 0x91, 0xf6, 0x0a, 0x1e, 0xc3, 0xc6, 0x57,
|
0x57, 0x96, 0x45, 0xc4, 0x79, 0x99, 0xbe, 0xe7, 0x40, 0xf7, 0x90, 0x51, 0x28, 0x68, 0x99, 0xf3,
|
||||||
0x46, 0x13, 0xc2, 0x79, 0xd5, 0x92, 0xc0, 0x03, 0xf7, 0x80, 0x91, 0x58, 0x90, 0x45, 0xcd, 0x27,
|
0x91, 0x26, 0x74, 0x9b, 0x73, 0x9a, 0xc7, 0xcb, 0x3a, 0xbf, 0x4c, 0xb0, 0x24, 0x34, 0xfa, 0x3a,
|
||||||
0x32, 0x26, 0xcb, 0x9a, 0xd3, 0x22, 0x5d, 0xf4, 0xf9, 0x65, 0x82, 0x25, 0xa1, 0x31, 0xd4, 0x35,
|
0x47, 0x53, 0xe6, 0xd8, 0xbb, 0x3b, 0x80, 0xba, 0x14, 0x1b, 0xab, 0x29, 0xee, 0x83, 0x25, 0xed,
|
||||||
0x9a, 0xb2, 0xc6, 0xde, 0xed, 0x17, 0x68, 0x2a, 0xb1, 0xb5, 0x5a, 0xe2, 0x3e, 0x58, 0x32, 0x4e,
|
0x64, 0xf2, 0xf5, 0xbd, 0x50, 0x4a, 0xde, 0x29, 0x58, 0xb2, 0x97, 0xe8, 0xc2, 0x1a, 0x27, 0x76,
|
||||||
0x16, 0xdf, 0xfc, 0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35, 0x2b, 0x77, 0x07, 0xdc, 0xca, 0xd9, 0x30, 0x0a, 0x10,
|
||||||
0x3c, 0xa8, 0x5e, 0x09, 0x1b, 0xb8, 0x77, 0x0b, 0xdc, 0xca, 0xfe, 0x30, 0x4a, 0x10, 0xf5, 0xbc,
|
0xd5, 0xd5, 0x07, 0x80, 0xac, 0x5c, 0x1a, 0x09, 0xa2, 0xc6, 0xe1, 0x01, 0x20, 0x2b, 0xc7, 0xc9,
|
||||||
0xf7, 0x00, 0x59, 0x59, 0x39, 0x12, 0x44, 0xcd, 0xc5, 0x3d, 0x40, 0x56, 0xb6, 0x94, 0x81, 0x5f,
|
0xc0, 0x31, 0xb4, 0x8a, 0x7f, 0xdc, 0x3d, 0xd5, 0xa9, 0x0e, 0xc2, 0xf2, 0x4f, 0xd1, 0x33, 0xf0,
|
||||||
0xaa, 0x0d, 0xb1, 0xdd, 0xf0, 0xa7, 0xd0, 0x3d, 0xda, 0x69, 0x32, 0xcf, 0x91, 0x46, 0xd0, 0x29,
|
0x73, 0x79, 0x5b, 0xb6, 0x6b, 0xfe, 0x27, 0x1a, 0x68, 0xa7, 0x4e, 0x5c, 0x22, 0x9d, 0xd9, 0xf2,
|
||||||
0x7f, 0xa5, 0x77, 0xf4, 0xb9, 0x9e, 0x62, 0xf1, 0xdf, 0x1b, 0x18, 0x67, 0xb6, 0xfc, 0x61, 0xbf,
|
0x9f, 0xfc, 0xfa, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xd0, 0xc0, 0x27, 0xbf, 0x07, 0x00,
|
||||||
0xfe, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xa6, 0xfc, 0x65, 0xca, 0xde, 0x07, 0x00, 0x00,
|
0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
@ -955,7 +922,7 @@ const _ = grpc.SupportPackageIsVersion4
|
|||||||
type RouterClient interface {
|
type RouterClient interface {
|
||||||
Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error)
|
Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error)
|
||||||
Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (Router_WatchClient, error)
|
Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (Router_WatchClient, error)
|
||||||
Advertise(ctx context.Context, in *AdvertiseRequest, opts ...grpc.CallOption) (Router_AdvertiseClient, error)
|
Advertise(ctx context.Context, in *Request, opts ...grpc.CallOption) (Router_AdvertiseClient, error)
|
||||||
Process(ctx context.Context, in *Advert, opts ...grpc.CallOption) (*ProcessResponse, error)
|
Process(ctx context.Context, in *Advert, opts ...grpc.CallOption) (*ProcessResponse, error)
|
||||||
Status(ctx context.Context, in *Request, opts ...grpc.CallOption) (*StatusResponse, error)
|
Status(ctx context.Context, in *Request, opts ...grpc.CallOption) (*StatusResponse, error)
|
||||||
}
|
}
|
||||||
@ -1009,7 +976,7 @@ func (x *routerWatchClient) Recv() (*Event, error) {
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *routerClient) Advertise(ctx context.Context, in *AdvertiseRequest, opts ...grpc.CallOption) (Router_AdvertiseClient, error) {
|
func (c *routerClient) Advertise(ctx context.Context, in *Request, opts ...grpc.CallOption) (Router_AdvertiseClient, error) {
|
||||||
stream, err := c.cc.NewStream(ctx, &_Router_serviceDesc.Streams[1], "/go.micro.router.Router/Advertise", opts...)
|
stream, err := c.cc.NewStream(ctx, &_Router_serviceDesc.Streams[1], "/go.micro.router.Router/Advertise", opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1063,7 +1030,7 @@ func (c *routerClient) Status(ctx context.Context, in *Request, opts ...grpc.Cal
|
|||||||
type RouterServer interface {
|
type RouterServer interface {
|
||||||
Lookup(context.Context, *LookupRequest) (*LookupResponse, error)
|
Lookup(context.Context, *LookupRequest) (*LookupResponse, error)
|
||||||
Watch(*WatchRequest, Router_WatchServer) error
|
Watch(*WatchRequest, Router_WatchServer) error
|
||||||
Advertise(*AdvertiseRequest, Router_AdvertiseServer) error
|
Advertise(*Request, Router_AdvertiseServer) error
|
||||||
Process(context.Context, *Advert) (*ProcessResponse, error)
|
Process(context.Context, *Advert) (*ProcessResponse, error)
|
||||||
Status(context.Context, *Request) (*StatusResponse, error)
|
Status(context.Context, *Request) (*StatusResponse, error)
|
||||||
}
|
}
|
||||||
@ -1112,7 +1079,7 @@ func (x *routerWatchServer) Send(m *Event) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func _Router_Advertise_Handler(srv interface{}, stream grpc.ServerStream) error {
|
func _Router_Advertise_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
m := new(AdvertiseRequest)
|
m := new(Request)
|
||||||
if err := stream.RecvMsg(m); err != nil {
|
if err := stream.RecvMsg(m); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1197,7 +1164,7 @@ var _Router_serviceDesc = grpc.ServiceDesc{
|
|||||||
ServerStreams: true,
|
ServerStreams: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Metadata: "go-micro/network/router/proto/router.proto",
|
Metadata: "micro/go-micro/router/proto/router.proto",
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableClient is the client API for Table service.
|
// TableClient is the client API for Table service.
|
||||||
@ -1207,8 +1174,8 @@ type TableClient interface {
|
|||||||
Create(ctx context.Context, in *Route, opts ...grpc.CallOption) (*CreateResponse, error)
|
Create(ctx context.Context, in *Route, opts ...grpc.CallOption) (*CreateResponse, error)
|
||||||
Delete(ctx context.Context, in *Route, opts ...grpc.CallOption) (*DeleteResponse, error)
|
Delete(ctx context.Context, in *Route, opts ...grpc.CallOption) (*DeleteResponse, error)
|
||||||
Update(ctx context.Context, in *Route, opts ...grpc.CallOption) (*UpdateResponse, error)
|
Update(ctx context.Context, in *Route, opts ...grpc.CallOption) (*UpdateResponse, error)
|
||||||
Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
|
|
||||||
List(ctx context.Context, in *Request, opts ...grpc.CallOption) (*ListResponse, error)
|
List(ctx context.Context, in *Request, opts ...grpc.CallOption) (*ListResponse, error)
|
||||||
|
Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type tableClient struct {
|
type tableClient struct {
|
||||||
@ -1246,18 +1213,18 @@ func (c *tableClient) Update(ctx context.Context, in *Route, opts ...grpc.CallOp
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *tableClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) {
|
func (c *tableClient) List(ctx context.Context, in *Request, opts ...grpc.CallOption) (*ListResponse, error) {
|
||||||
out := new(QueryResponse)
|
out := new(ListResponse)
|
||||||
err := c.cc.Invoke(ctx, "/go.micro.router.Table/Query", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/go.micro.router.Table/List", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *tableClient) List(ctx context.Context, in *Request, opts ...grpc.CallOption) (*ListResponse, error) {
|
func (c *tableClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) {
|
||||||
out := new(ListResponse)
|
out := new(QueryResponse)
|
||||||
err := c.cc.Invoke(ctx, "/go.micro.router.Table/List", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/go.micro.router.Table/Query", in, out, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1269,8 +1236,8 @@ type TableServer interface {
|
|||||||
Create(context.Context, *Route) (*CreateResponse, error)
|
Create(context.Context, *Route) (*CreateResponse, error)
|
||||||
Delete(context.Context, *Route) (*DeleteResponse, error)
|
Delete(context.Context, *Route) (*DeleteResponse, error)
|
||||||
Update(context.Context, *Route) (*UpdateResponse, error)
|
Update(context.Context, *Route) (*UpdateResponse, error)
|
||||||
Query(context.Context, *QueryRequest) (*QueryResponse, error)
|
|
||||||
List(context.Context, *Request) (*ListResponse, error)
|
List(context.Context, *Request) (*ListResponse, error)
|
||||||
|
Query(context.Context, *QueryRequest) (*QueryResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func RegisterTableServer(s *grpc.Server, srv TableServer) {
|
func RegisterTableServer(s *grpc.Server, srv TableServer) {
|
||||||
@ -1331,24 +1298,6 @@ func _Table_Update_Handler(srv interface{}, ctx context.Context, dec func(interf
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _Table_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(QueryRequest)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(TableServer).Query(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: "/go.micro.router.Table/Query",
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(TableServer).Query(ctx, req.(*QueryRequest))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _Table_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _Table_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(Request)
|
in := new(Request)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@ -1367,6 +1316,24 @@ func _Table_List_Handler(srv interface{}, ctx context.Context, dec func(interfac
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Table_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(QueryRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(TableServer).Query(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/go.micro.router.Table/Query",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(TableServer).Query(ctx, req.(*QueryRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
var _Table_serviceDesc = grpc.ServiceDesc{
|
var _Table_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "go.micro.router.Table",
|
ServiceName: "go.micro.router.Table",
|
||||||
HandlerType: (*TableServer)(nil),
|
HandlerType: (*TableServer)(nil),
|
||||||
@ -1383,15 +1350,15 @@ var _Table_serviceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "Update",
|
MethodName: "Update",
|
||||||
Handler: _Table_Update_Handler,
|
Handler: _Table_Update_Handler,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
MethodName: "Query",
|
|
||||||
Handler: _Table_Query_Handler,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
MethodName: "List",
|
MethodName: "List",
|
||||||
Handler: _Table_List_Handler,
|
Handler: _Table_List_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "Query",
|
||||||
|
Handler: _Table_Query_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "go-micro/network/router/proto/router.proto",
|
Metadata: "micro/go-micro/router/proto/router.proto",
|
||||||
}
|
}
|
@ -9,8 +9,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/micro/go-micro/client"
|
"github.com/micro/go-micro/client"
|
||||||
"github.com/micro/go-micro/network/router"
|
"github.com/micro/go-micro/router"
|
||||||
pb "github.com/micro/go-micro/network/router/proto"
|
pb "github.com/micro/go-micro/router/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type svc struct {
|
type svc struct {
|
@ -4,8 +4,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/micro/go-micro/client"
|
"github.com/micro/go-micro/client"
|
||||||
"github.com/micro/go-micro/network/router"
|
"github.com/micro/go-micro/router"
|
||||||
pb "github.com/micro/go-micro/network/router/proto"
|
pb "github.com/micro/go-micro/router/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type table struct {
|
type table struct {
|
@ -5,8 +5,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/micro/go-micro/network/router"
|
"github.com/micro/go-micro/router"
|
||||||
pb "github.com/micro/go-micro/network/router/proto"
|
pb "github.com/micro/go-micro/router/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type watcher struct {
|
type watcher struct {
|
Loading…
Reference in New Issue
Block a user