MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / ufwUpdatePort

Function ufwUpdatePort

core/utils/firewall/firewall.go:43–51  ·  view source on GitHub ↗
(oldPort, newPort string)

Source from the content-addressed store, hash-verified

41}
42
43func ufwUpdatePort(oldPort, newPort string) error {
44 stdout, err := cmd.NewCommandMgr().RunWithStdout("ufw", "allow", newPort)
45 if err != nil {
46 return fmt.Errorf("add (port: %s/tcp) failed, err: %s", newPort, stdout)
47 }
48
49 _, _ = cmd.NewCommandMgr().RunWithStdout("ufw", "delete", "allow", oldPort)
50 return nil
51}

Callers 1

UpdatePortFunction · 0.85

Calls 1

RunWithStdoutMethod · 0.45

Tested by

no test coverage detected