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

@@ -36,12 +36,19 @@ type DialOption func(*DialOptions)
type DialOptions struct {
// Link specifies the link to use
Link string
// specify a multicast connection
Multicast bool
// specify mode of the session
Mode Mode
// the dial timeout
Timeout time.Duration
}
type ListenOption func(*ListenOptions)
type ListenOptions struct {
// specify mode of the session
Mode Mode
}
// The tunnel id
func Id(id string) Option {
return func(o *Options) {
@@ -87,12 +94,19 @@ func DefaultOptions() Options {
}
}
// Listen options
func ListenMulticast() ListenOption {
return func(o *ListenOptions) {
o.Mode = Multicast
}
}
// Dial options
// Dial multicast sets the multicast option to send only to those mapped
func DialMulticast() DialOption {
return func(o *DialOptions) {
o.Multicast = true
o.Mode = Multicast
}
}