Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) Create(ctx context.Context, req CreateRequest) error
- func (c *Client) Delete(ctx context.Context, req DeleteRequest) error
- func (c *Client) Find(ctx context.Context, req FindRequest) (FindResponse, error)
- func (c *Client) Index(ctx context.Context, req IndexRequest) ([]IndexResponse, error)
- func (c *Client) Update(ctx context.Context, req UpdateRequest) error
- type CreateRequest
- type DeleteRequest
- type FindRequest
- type FindResponse
- type HTTPClient
- type IndexRequest
- type IndexResponse
- type Log
- type Type
- type UpdateRequest
Constants ¶
View Source
const ( Log_EMERG Log = "emerg" Log_ALERT Log = "alert" Log_CRIT Log = "crit" Log_ERR Log = "err" Log_WARNING Log = "warning" Log_NOTICE Log = "notice" Log_INFO Log = "info" Log_DEBUG Log = "debug" Log_NOLOG Log = "nolog" Type_IN Type = "in" Type_OUT Type = "out" Type_GROUP Type = "group" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
func New(c HTTPClient) *Client
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, req CreateRequest) error
Create Create new rule.
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, req DeleteRequest) error
Delete Delete rule.
func (*Client) Find ¶
func (c *Client) Find(ctx context.Context, req FindRequest) (FindResponse, error)
Find Get single rule data.
func (*Client) Index ¶
func (c *Client) Index(ctx context.Context, req IndexRequest) ([]IndexResponse, error)
Index List rules.
type CreateRequest ¶
type CreateRequest struct { Action string `url:"action" json:"action"` // Rule action ('ACCEPT', 'DROP', 'REJECT') or security group name. Node string `url:"node" json:"node"` // The cluster node name. Type Type `url:"type" json:"type"` // Rule type. Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM. // The following parameters are optional Comment *string `url:"comment,omitempty" json:"comment,omitempty"` // Descriptive comment. Dest *string `url:"dest,omitempty" json:"dest,omitempty"` // Restrict packet destination address. This can refer to a single IP address, an IP set ('+ipsetname') or an IP alias definition. You can also specify an address range like '20.34.101.207-201.3.9.99', or a list of IP addresses and networks (entries are separated by comma). Please do not mix IPv4 and IPv6 addresses inside such lists. Digest *string `url:"digest,omitempty" json:"digest,omitempty"` // Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications. Dport *string `url:"dport,omitempty" json:"dport,omitempty"` // Restrict TCP/UDP destination port. You can use service names or simple numbers (0-65535), as defined in '/etc/services'. Port ranges can be specified with '\d+:\d+', for example '80:85', and you can use comma separated list to match several ports or ranges. Enable *int `url:"enable,omitempty" json:"enable,omitempty"` // Flag to enable/disable a rule. IcmpType *string `url:"icmp-type,omitempty" json:"icmp-type,omitempty"` // Specify icmp-type. Only valid if proto equals 'icmp'. Iface *string `url:"iface,omitempty" json:"iface,omitempty"` // Network interface name. You have to use network configuration key names for VMs and containers ('net\d+'). Host related rules can use arbitrary strings. Log *Log `url:"log,omitempty" json:"log,omitempty"` // Log level for firewall rule. Macro *string `url:"macro,omitempty" json:"macro,omitempty"` // Use predefined standard macro. Pos *int `url:"pos,omitempty" json:"pos,omitempty"` // Update rule at position <pos>. Proto *string `url:"proto,omitempty" json:"proto,omitempty"` // IP protocol. You can use protocol names ('tcp'/'udp') or simple numbers, as defined in '/etc/protocols'. Source *string `url:"source,omitempty" json:"source,omitempty"` // Restrict packet source address. This can refer to a single IP address, an IP set ('+ipsetname') or an IP alias definition. You can also specify an address range like '20.34.101.207-201.3.9.99', or a list of IP addresses and networks (entries are separated by comma). Please do not mix IPv4 and IPv6 addresses inside such lists. Sport *string `url:"sport,omitempty" json:"sport,omitempty"` // Restrict TCP/UDP source port. You can use service names or simple numbers (0-65535), as defined in '/etc/services'. Port ranges can be specified with '\d+:\d+', for example '80:85', and you can use comma separated list to match several ports or ranges. }
type DeleteRequest ¶
type DeleteRequest struct { Node string `url:"node" json:"node"` // The cluster node name. Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM. // The following parameters are optional Digest *string `url:"digest,omitempty" json:"digest,omitempty"` // Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications. Pos *int `url:"pos,omitempty" json:"pos,omitempty"` // Update rule at position <pos>. }
type FindRequest ¶
type FindResponse ¶
type FindResponse struct { Action string `url:"action" json:"action"` Pos int `url:"pos" json:"pos"` Type string `url:"type" json:"type"` // The following parameters are optional Comment *string `url:"comment,omitempty" json:"comment,omitempty"` Dest *string `url:"dest,omitempty" json:"dest,omitempty"` Dport *string `url:"dport,omitempty" json:"dport,omitempty"` Enable *int `url:"enable,omitempty" json:"enable,omitempty"` IcmpType *string `url:"icmp-type,omitempty" json:"icmp-type,omitempty"` Iface *string `url:"iface,omitempty" json:"iface,omitempty"` Ipversion *int `url:"ipversion,omitempty" json:"ipversion,omitempty"` Log *Log `url:"log,omitempty" json:"log,omitempty"` // Log level for firewall rule Macro *string `url:"macro,omitempty" json:"macro,omitempty"` Proto *string `url:"proto,omitempty" json:"proto,omitempty"` Source *string `url:"source,omitempty" json:"source,omitempty"` Sport *string `url:"sport,omitempty" json:"sport,omitempty"` }
type HTTPClient ¶
type IndexRequest ¶
type IndexResponse ¶
type IndexResponse struct {
Pos int `url:"pos" json:"pos"`
}
type UpdateRequest ¶
type UpdateRequest struct { Node string `url:"node" json:"node"` // The cluster node name. Vmid int `url:"vmid" json:"vmid"` // The (unique) ID of the VM. // The following parameters are optional Action *string `url:"action,omitempty" json:"action,omitempty"` // Rule action ('ACCEPT', 'DROP', 'REJECT') or security group name. Comment *string `url:"comment,omitempty" json:"comment,omitempty"` // Descriptive comment. Delete *string `url:"delete,omitempty" json:"delete,omitempty"` // A list of settings you want to delete. Dest *string `url:"dest,omitempty" json:"dest,omitempty"` // Restrict packet destination address. This can refer to a single IP address, an IP set ('+ipsetname') or an IP alias definition. You can also specify an address range like '20.34.101.207-201.3.9.99', or a list of IP addresses and networks (entries are separated by comma). Please do not mix IPv4 and IPv6 addresses inside such lists. Digest *string `url:"digest,omitempty" json:"digest,omitempty"` // Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications. Dport *string `url:"dport,omitempty" json:"dport,omitempty"` // Restrict TCP/UDP destination port. You can use service names or simple numbers (0-65535), as defined in '/etc/services'. Port ranges can be specified with '\d+:\d+', for example '80:85', and you can use comma separated list to match several ports or ranges. Enable *int `url:"enable,omitempty" json:"enable,omitempty"` // Flag to enable/disable a rule. IcmpType *string `url:"icmp-type,omitempty" json:"icmp-type,omitempty"` // Specify icmp-type. Only valid if proto equals 'icmp'. Iface *string `url:"iface,omitempty" json:"iface,omitempty"` // Network interface name. You have to use network configuration key names for VMs and containers ('net\d+'). Host related rules can use arbitrary strings. Log *Log `url:"log,omitempty" json:"log,omitempty"` // Log level for firewall rule. Macro *string `url:"macro,omitempty" json:"macro,omitempty"` // Use predefined standard macro. Moveto *int `url:"moveto,omitempty" json:"moveto,omitempty"` // Move rule to new position <moveto>. Other arguments are ignored. Pos *int `url:"pos,omitempty" json:"pos,omitempty"` // Update rule at position <pos>. Proto *string `url:"proto,omitempty" json:"proto,omitempty"` // IP protocol. You can use protocol names ('tcp'/'udp') or simple numbers, as defined in '/etc/protocols'. Source *string `url:"source,omitempty" json:"source,omitempty"` // Restrict packet source address. This can refer to a single IP address, an IP set ('+ipsetname') or an IP alias definition. You can also specify an address range like '20.34.101.207-201.3.9.99', or a list of IP addresses and networks (entries are separated by comma). Please do not mix IPv4 and IPv6 addresses inside such lists. Sport *string `url:"sport,omitempty" json:"sport,omitempty"` // Restrict TCP/UDP source port. You can use service names or simple numbers (0-65535), as defined in '/etc/services'. Port ranges can be specified with '\d+:\d+', for example '80:85', and you can use comma separated list to match several ports or ranges. Type *Type `url:"type,omitempty" json:"type,omitempty"` // Rule type. }
Click to show internal directories.
Click to hide internal directories.