rules

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

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) (*CreateResponse, error)

Create Create new rule.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, 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.

func (*Client) Update

func (c *Client) Update(ctx context.Context, req *UpdateRequest) (*UpdateResponse, error)

Update Modify rule data.

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   string `url:"type",json:"type"`     // Rule type.

	// 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      *string `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 CreateResponse

type CreateResponse map[string]interface{}

type DeleteRequest

type DeleteRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.

	// 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 DeleteResponse

type DeleteResponse map[string]interface{}

type FindRequest

type FindRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.

	// The following parameters are optional
	Pos *int `url:"pos,omitempty",json:"pos,omitempty"` // Update rule at position <pos>.
}

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       *string `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 HTTPClient interface {
	Do(context.Context, string, string, interface{}, interface{}) error
}

type IndexRequest

type IndexRequest struct {
	Node string `url:"node",json:"node"` // The cluster node name.

}

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.

	// 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      *string `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     *string `url:"type,omitempty",json:"type,omitempty"`           // Rule type.
}

type UpdateResponse

type UpdateResponse map[string]interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL