Tunnel mode

This commit is contained in:
Asim Aslam
2019-10-15 15:40:04 +01:00
parent 44b794722e
commit 7b1f5584ab
6 changed files with 67 additions and 37 deletions

View File

@@ -8,6 +8,12 @@ import (
"github.com/micro/go-micro/transport"
)
const (
Unicast Mode = iota
Multicast
Broadcast
)
var (
// DefaultDialTimeout is the dial timeout if none is specified
DefaultDialTimeout = time.Second * 5
@@ -19,6 +25,8 @@ var (
ErrLinkNotFound = errors.New("link not found")
)
type Mode uint8
// Tunnel creates a gre tunnel on top of the go-micro/transport.
// It establishes multiple streams using the Micro-Tunnel-Channel header
// and Micro-Tunnel-Session header. The tunnel id is a hash of
@@ -36,7 +44,7 @@ type Tunnel interface {
// Connect to a channel
Dial(channel string, opts ...DialOption) (Session, error)
// Accept connections on a channel
Listen(channel string) (Listener, error)
Listen(channel string, opts ...ListenOption) (Listener, error)
// Name of the tunnel implementation
String() string
}