1
0
Fork 0

fix: test all endpoints and responses

This commit is contained in:
Seraphim Strub 2024-08-04 17:37:53 +00:00
parent 8c8b86bfa0
commit 32575babdb

View file

@ -294,8 +294,8 @@ func (c *Client) Reports(ctx context.Context, ip net.IP, opts *ReportsOptions) (
type BlacklistOptions struct {
ConfidenceMinimum int `json:"confidenceMinimum,omitempty"`
Limit int `json:"limit,omitempty"`
OnlyCountries []string `json:"onlyCountries,omitempty"`
ExceptCountries []string `json:"exceptCountries,omitempty"`
OnlyCountries []string `json:"onlyCountries,omitempty"` // does not work?
ExceptCountries []string `json:"exceptCountries,omitempty"` // seems to work
IpVersion int `json:"ipVersion,omitempty"`
}
@ -445,14 +445,14 @@ type CheckBlockResult struct {
} `json:"data"`
}
func (c *Client) CheckBlock(ctx context.Context, ipnNet net.IPNet, opts *CheckBlockOptions) (*CheckBlockResult, error) {
func (c *Client) CheckBlock(ctx context.Context, ipnNet *net.IPNet, opts *CheckBlockOptions) (*CheckBlockResult, error) {
var endpoint = "check-block"
network := html.EscapeString(ipnNet.String())
parameters := map[string]string{
"network": network,
}
// TODO check network
if opts != nil {
if opts.MaxAgeInDays > 0 && opts.MaxAgeInDays <= 365 {
parameters["maxAgeInDays"] = strconv.Itoa(opts.MaxAgeInDays)