f7008ab86b
validateurl.go is VCS-generic but imported gitea.IsBlockedIP, creating an unexpected generic→Gitea-specific dependency. Extract IsBlockedIP and its CIDR list to internal/netutil/ipcheck.go (a neutral shared package). - gitea/ipcheck.go becomes a thin forwarding wrapper (preserves API compat for callers within the gitea package) - gitea/ipcheck_test.go replaced with a forwarding smoke test; full coverage moves to internal/netutil/ipcheck_test.go - validateurl.go now imports internal/netutil directly
23 lines
871 B
Go
23 lines
871 B
Go
// Package gitea provides a client for the Gitea API.
|
|
// ipcheck.go re-exports the IsBlockedIP function from internal/netutil for use
|
|
// by this package's safe dialer (client.go) and for backward compatibility with
|
|
// any callers that previously imported it from here.
|
|
//
|
|
// The implementation has moved to internal/netutil so it can be shared with the
|
|
// validate-url subcommand (cmd/review-bot/validateurl.go) without creating a
|
|
// dependency from VCS-generic code on the Gitea-specific package.
|
|
package gitea
|
|
|
|
import (
|
|
"net"
|
|
|
|
"gitea.weiker.me/rodin/review-bot/internal/netutil"
|
|
)
|
|
|
|
// IsBlockedIP reports whether ip is in a blocked address range.
|
|
// It delegates to internal/netutil.IsBlockedIP; see that function for the full
|
|
// list of blocked ranges and IPv6-mapped IPv4 normalization behavior.
|
|
func IsBlockedIP(ip net.IP) bool {
|
|
return netutil.IsBlockedIP(ip)
|
|
}
|