Feature: add support for multicast (#245)

* add support for multicast (#243)

* adjust setup

---------

Co-authored-by: xjasonlyu <xjasonlyu@gmail.com>
This commit is contained in:
Amaindex
2023-08-28 03:40:49 +08:00
committed by GitHub
parent fffcbbea10
commit 90f77548ed
6 changed files with 96 additions and 0 deletions

View File

@@ -193,6 +193,11 @@ func netstack(k *Key) (err error) {
return
}
var multicastGroups []net.IP
if multicastGroups, err = parseMulticastGroups(k.MulticastGroups); err != nil {
return err
}
var opts []option.Option
if k.TCPModerateReceiveBuffer {
opts = append(opts, option.WithTCPModerateReceiveBuffer(true))
@@ -217,6 +222,7 @@ func netstack(k *Key) (err error) {
if _defaultStack, err = core.CreateStack(&core.Config{
LinkEndpoint: _defaultDevice,
TransportHandler: &mirror.Tunnel{},
MulticastGroups: multicastGroups,
Options: opts,
}); err != nil {
return