fix: use generic set in pkg/util/iptables

This commit is contained in:
21kyu
2023-11-08 15:21:59 +00:00
parent e4b74dd12f
commit fec63d5ea0
4 changed files with 44 additions and 36 deletions

View File

@@ -41,17 +41,17 @@ import (
type monitorFakeExec struct {
sync.Mutex
tables map[string]sets.String
tables map[string]sets.Set[string]
block bool
wasBlocked bool
}
func newMonitorFakeExec() *monitorFakeExec {
tables := make(map[string]sets.String)
tables["mangle"] = sets.NewString()
tables["filter"] = sets.NewString()
tables["nat"] = sets.NewString()
tables := make(map[string]sets.Set[string])
tables["mangle"] = sets.New[string]()
tables["filter"] = sets.New[string]()
tables["nat"] = sets.New[string]()
return &monitorFakeExec{tables: tables}
}
@@ -148,33 +148,43 @@ func (mfc *monitorFakeCmd) SetStdin(in io.Reader) {
func (mfc *monitorFakeCmd) Run() error {
panic("should not be reached")
}
func (mfc *monitorFakeCmd) Output() ([]byte, error) {
panic("should not be reached")
}
func (mfc *monitorFakeCmd) SetDir(dir string) {
panic("should not be reached")
}
func (mfc *monitorFakeCmd) SetStdout(out io.Writer) {
panic("should not be reached")
}
func (mfc *monitorFakeCmd) SetStderr(out io.Writer) {
panic("should not be reached")
}
func (mfc *monitorFakeCmd) SetEnv(env []string) {
panic("should not be reached")
}
func (mfc *monitorFakeCmd) StdoutPipe() (io.ReadCloser, error) {
panic("should not be reached")
}
func (mfc *monitorFakeCmd) StderrPipe() (io.ReadCloser, error) {
panic("should not be reached")
}
func (mfc *monitorFakeCmd) Start() error {
panic("should not be reached")
}
func (mfc *monitorFakeCmd) Wait() error {
panic("should not be reached")
}
func (mfc *monitorFakeCmd) Stop() {
panic("should not be reached")
}