(ipStr string)
| 355 | } |
| 356 | |
| 357 | func ParseIP(ipStr string) pqtype.Inet { |
| 358 | ip := net.ParseIP(ipStr) |
| 359 | ipNet := net.IPNet{} |
| 360 | if ip != nil { |
| 361 | ipNet = net.IPNet{ |
| 362 | IP: ip, |
| 363 | Mask: net.CIDRMask(len(ip)*8, len(ip)*8), |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | return pqtype.Inet{ |
| 368 | IPNet: ipNet, |
| 369 | Valid: ip != nil, |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | // AllowList is a typed wrapper around a list of AllowListTarget entries. |
| 374 | // It implements sql.Scanner and driver.Valuer so it can be stored in and |
no outgoing calls