8000 [pull] main from miniflux:main by pull[bot] · Pull Request #250 · suhaoGe/miniflux · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ type Client struct {
// New returns a new Miniflux client.
//
// Deprecated: use NewClient instead.
//
//go:fix inline
func New(endpoint string, credentials ...string) *Client {
return NewClient(endpoint, credentials...)
}
Expand Down
7 changes: 7 additions & 0 deletions internal/urllib/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import (
"errors"
"fmt"
"net"
"net/netip"
"net/url"
"strings"
)

var rfc6598SharedAddressSpacePrefix = netip.MustParsePrefix("100.64.0.0/10")

// IsRelativePath reports whether the link is a relative path (no scheme, host, or scheme-relative // form).
func IsRelativePath(link string) bool {
if link == "" {
Expand Down Expand Up @@ -161,6 +164,10 @@ func IsNonPublicIP(ip net.IP) bool {
return true
}

if addr, ok := netip.AddrFromSlice(ip); ok && rfc6598SharedAddressSpacePrefix.Contains(addr.Unmap()) {
return true
}

return ip.IsPrivate() ||
ip.IsLoopback() ||
ip.IsLinkLocalUnicast() ||
Expand Down
1 change: 1 addition & 0 deletions internal/urllib/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func TestIsNonPublicIP(t *testing.T) {
}{
{"nil", "", true},
{"private IPv4", "192.168.1.10", true},
{"shared address space IPv4", "100.64.0.1", true},
{"loopback IPv4", "127.0.0.1", true},
{"link-local IPv4", "169.254.42.1", true},
{"multicast IPv4", "224.0.0.1", true},
Expand Down
0