Files
cunicu/test/net/filtered.go
2022-08-04 00:20:43 +02:00

37 lines
741 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//go:build linux
package net
import (
"net"
g "github.com/stv0g/gont/pkg"
gopt "github.com/stv0g/gont/pkg/options"
gfopt "github.com/stv0g/gont/pkg/options/filters"
)
func Filtered(p *NetworkParams) (*Network, error) {
// We are dropped packets between the ɯice nodes to force ICE using the relay
_, hostNetV4, err := net.ParseCIDR("10.0.1.0/24")
if err != nil {
return nil, err
}
_, hostNetV6, err := net.ParseCIDR("fc::1:0/112")
if err != nil {
return nil, err
}
p.HostOptions = append(p.HostOptions,
gopt.Filter(g.FilterInput, gfopt.Source(hostNetV4), gfopt.Drop),
gopt.Filter(g.FilterInput, gfopt.Source(hostNetV6), gfopt.Drop),
)
n, err := Simple(p)
if err != nil {
return nil, err
}
return n, nil
}