Tunnel discover/announce/open/session/close
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package tunnel
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/micro/go-micro/transport"
|
||||
"github.com/micro/go-micro/transport/quic"
|
||||
@@ -29,6 +31,15 @@ type Options struct {
|
||||
Transport transport.Transport
|
||||
}
|
||||
|
||||
type DialOption func(*DialOptions)
|
||||
|
||||
type DialOptions struct {
|
||||
// specify a multicast connection
|
||||
Multicast bool
|
||||
// the dial timeout
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
// The tunnel id
|
||||
func Id(id string) Option {
|
||||
return func(o *Options) {
|
||||
@@ -73,3 +84,18 @@ func DefaultOptions() Options {
|
||||
Transport: quic.NewTransport(),
|
||||
}
|
||||
}
|
||||
|
||||
// Dial options
|
||||
|
||||
// Dial multicast sets the multicast option to send only to those mapped
|
||||
func DialMulticast() DialOption {
|
||||
return func(o *DialOptions) {
|
||||
o.Multicast = true
|
||||
}
|
||||
}
|
||||
|
||||
func DialTimeout(t time.Duration) DialOption {
|
||||
return func(o *DialOptions) {
|
||||
o.Timeout = t
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user