52 lines
1.5 KiB
Go
52 lines
1.5 KiB
Go
package main
|
|
|
|
// HeaderRule is a single user-defined header from Zoraxy's API.
|
|
type HeaderRule struct {
|
|
Direction int `json:"Direction"`
|
|
Key string `json:"Key"`
|
|
Value string `json:"Value"`
|
|
IsRemove bool `json:"IsRemove"`
|
|
}
|
|
|
|
// ProxyRule is a proxy rule entry from GET /api/proxy/list?type=host.
|
|
type ProxyRule struct {
|
|
RootOrMatchingDomain string `json:"RootOrMatchingDomain"`
|
|
Tags []string `json:"Tags"`
|
|
}
|
|
|
|
// TagGroup groups the domains that share a tag, plus the identified source.
|
|
type TagGroup struct {
|
|
Tag string `json:"tag"`
|
|
Domains []string `json:"domains"`
|
|
Source string `json:"source"` // domain that already has headers (template)
|
|
HasSource bool `json:"has_source"`
|
|
}
|
|
|
|
// TagGroupsResponse is the payload sent to the frontend.
|
|
type TagGroupsResponse struct {
|
|
Groups []TagGroup `json:"groups"`
|
|
}
|
|
|
|
// ApplyRequest asks the plugin to copy the source domain's headers to targets.
|
|
type ApplyRequest struct {
|
|
Tag string `json:"tag"`
|
|
Source string `json:"source"`
|
|
Targets []string `json:"targets"`
|
|
}
|
|
|
|
// ActionResult reports per-domain success/failure.
|
|
type ActionResult struct {
|
|
Domain string `json:"domain"`
|
|
Success bool `json:"success"`
|
|
Error string `json:"error,omitempty"`
|
|
}
|
|
|
|
// ApplyResponse is returned after an apply/remove operation.
|
|
type ApplyResponse struct {
|
|
Results []ActionResult `json:"results"`
|
|
}
|
|
|
|
// ErrorResponse is a generic error.
|
|
type ErrorResponse struct {
|
|
Error string `json:"error"`
|
|
}
|