36b3af2e3d
PR Check / Code Quality: Format (push) Failing after 1s
PR Check / Code Quality: Lint (darwin) (push) Failing after 0s
PR Check / Code Quality: Lint (freebsd) (push) Failing after 1s
PR Check / Code Quality: Lint (windows) (push) Failing after 1s
PR Check / Code Quality: Lint (linux) (push) Failing after 1s
PR Check / Security: Vulnerability Scan (push) Failing after 0s
Update Documentation / update-docs (push) Failing after 2s
PR Check / Code Quality: Vendor (push) Failing after 1s
PR Check / Code Quality: Coverage (push) Failing after 0s
PR Check / Tests: Unit (macos-latest) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04-arm) (push) Has been cancelled
PR Check / Tests: Unit (windows-latest) (push) Has been cancelled
19 lines
507 B
Go
19 lines
507 B
Go
package source
|
|
|
|
import "github.com/pranshuparmar/witr/pkg/model"
|
|
|
|
// IsPublicBind reports whether any listening socket is bound to a public
|
|
// (any-address) interface. Non-listening sockets are ignored — an established
|
|
// outbound connection to a public address is not the same as exposing one.
|
|
func IsPublicBind(sockets []model.Socket) bool {
|
|
for _, s := range sockets {
|
|
if s.State != "LISTEN" {
|
|
continue
|
|
}
|
|
if s.Address == "0.0.0.0" || s.Address == "::" {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|