- Added API integration for access lists including listing, creating, updating, deleting, and testing IPs against access lists. - Created AccessListForm component for creating and editing access lists with validation. - Developed AccessListSelector component for selecting access lists with detailed display of selected ACL. - Implemented hooks for managing access lists and handling API interactions. - Added tests for AccessListSelector and useAccessLists hooks to ensure functionality. - Enhanced AccessLists page with UI for managing access lists, including create, edit, delete, and test IP features.
28 lines
1.2 KiB
Go
28 lines
1.2 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// AccessList defines IP-based or auth-based access control rules
|
|
// that can be applied to proxy hosts.
|
|
type AccessList struct {
|
|
ID uint `json:"id" gorm:"primaryKey"`
|
|
UUID string `json:"uuid" gorm:"uniqueIndex"`
|
|
Name string `json:"name" gorm:"index"`
|
|
Description string `json:"description"`
|
|
Type string `json:"type"` // "whitelist", "blacklist", "geo_whitelist", "geo_blacklist"
|
|
IPRules string `json:"ip_rules" gorm:"type:text"` // JSON array of IP/CIDR rules
|
|
CountryCodes string `json:"country_codes"` // Comma-separated ISO country codes (for geo types)
|
|
LocalNetworkOnly bool `json:"local_network_only"` // RFC1918 private networks only
|
|
Enabled bool `json:"enabled"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
// AccessListRule represents a single IP or CIDR rule
|
|
type AccessListRule struct {
|
|
CIDR string `json:"cidr"` // IP address or CIDR notation
|
|
Description string `json:"description"` // Optional description
|
|
}
|