firewall

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogLevelIn_EMERG   LogLevelIn = "emerg"
	LogLevelIn_ALERT   LogLevelIn = "alert"
	LogLevelIn_CRIT    LogLevelIn = "crit"
	LogLevelIn_ERR     LogLevelIn = "err"
	LogLevelIn_WARNING LogLevelIn = "warning"
	LogLevelIn_NOTICE  LogLevelIn = "notice"
	LogLevelIn_INFO    LogLevelIn = "info"
	LogLevelIn_DEBUG   LogLevelIn = "debug"
	LogLevelIn_NOLOG   LogLevelIn = "nolog"

	LogLevelOut_EMERG   LogLevelOut = "emerg"
	LogLevelOut_ALERT   LogLevelOut = "alert"
	LogLevelOut_CRIT    LogLevelOut = "crit"
	LogLevelOut_ERR     LogLevelOut = "err"
	LogLevelOut_WARNING LogLevelOut = "warning"
	LogLevelOut_NOTICE  LogLevelOut = "notice"
	LogLevelOut_INFO    LogLevelOut = "info"
	LogLevelOut_DEBUG   LogLevelOut = "debug"
	LogLevelOut_NOLOG   LogLevelOut = "nolog"

	PolicyIn_ACCEPT PolicyIn = "ACCEPT"
	PolicyIn_REJECT PolicyIn = "REJECT"
	PolicyIn_DROP   PolicyIn = "DROP"

	PolicyOut_ACCEPT PolicyOut = "ACCEPT"
	PolicyOut_REJECT PolicyOut = "REJECT"
	PolicyOut_DROP   PolicyOut = "DROP"

	Type_ALIAS Type = "alias"
	Type_IPSET Type = "ipset"
)

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) GetOptions

func (c *Client) GetOptions(ctx context.Context, req GetOptionsRequest) (GetOptionsResponse, error)

GetOptions Get VM firewall options.

func (*Client) Index

func (c *Client) Index(ctx context.Context, req IndexRequest) ([]map[string]interface{}, error)

Index Directory index.

func (*Client) Log

func (c *Client) Log(ctx context.Context, req LogRequest) ([]LogResponse, error)

Log Read firewall log

func (*Client) Refs

func (c *Client) Refs(ctx context.Context, req RefsRequest) ([]RefsResponse, error)

Refs Lists possible IPSet/Alias reference which are allowed in source/dest properties.

func (*Client) SetOptions

func (c *Client) SetOptions(ctx context.Context, req SetOptionsRequest) error

SetOptions Set Firewall options.

type GetOptionsRequest

type GetOptionsRequest struct {
	Node string `url:"node" json:"node"` // The cluster node name.
	Vmid int    `url:"vmid" json:"vmid"` // The (unique) ID of the VM.

}

type GetOptionsResponse

type GetOptionsResponse struct {

	// The following parameters are optional
	Dhcp        *util.PVEBool `url:"dhcp,omitempty" json:"dhcp,omitempty"`                   // Enable DHCP.
	Enable      *util.PVEBool `url:"enable,omitempty" json:"enable,omitempty"`               // Enable/disable firewall rules.
	Ipfilter    *util.PVEBool `url:"ipfilter,omitempty" json:"ipfilter,omitempty"`           // Enable default IP filters. This is equivalent to adding an empty ipfilter-net<id> ipset for every interface. Such ipsets implicitly contain sane default restrictions such as restricting IPv6 link local addresses to the one derived from the interface's MAC address. For containers the configured IP addresses will be implicitly added.
	LogLevelIn  *LogLevelIn   `url:"log_level_in,omitempty" json:"log_level_in,omitempty"`   // Log level for incoming traffic.
	LogLevelOut *LogLevelOut  `url:"log_level_out,omitempty" json:"log_level_out,omitempty"` // Log level for outgoing traffic.
	Macfilter   *util.PVEBool `url:"macfilter,omitempty" json:"macfilter,omitempty"`         // Enable/disable MAC address filter.
	Ndp         *util.PVEBool `url:"ndp,omitempty" json:"ndp,omitempty"`                     // Enable NDP (Neighbor Discovery Protocol).
	PolicyIn    *PolicyIn     `url:"policy_in,omitempty" json:"policy_in,omitempty"`         // Input policy.
	PolicyOut   *PolicyOut    `url:"policy_out,omitempty" json:"policy_out,omitempty"`       // Output policy.
	Radv        *util.PVEBool `url:"radv,omitempty" json:"radv,omitempty"`                   // Allow sending Router Advertisement.
}

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.
	Vmid int    `url:"vmid" json:"vmid"` // The (unique) ID of the VM.

}

type LogLevelIn added in v0.0.15

type LogLevelIn string

func PtrLogLevelIn added in v0.0.15

func PtrLogLevelIn(i LogLevelIn) *LogLevelIn

type LogLevelOut added in v0.0.15

type LogLevelOut string

func PtrLogLevelOut added in v0.0.15

func PtrLogLevelOut(i LogLevelOut) *LogLevelOut

type LogRequest

type LogRequest 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
	Limit *int `url:"limit,omitempty" json:"limit,omitempty"`
	Since *int `url:"since,omitempty" json:"since,omitempty"` // Display log since this UNIX epoch.
	Start *int `url:"start,omitempty" json:"start,omitempty"`
	Until *int `url:"until,omitempty" json:"until,omitempty"` // Display log until this UNIX epoch.
}

type LogResponse

type LogResponse struct {
	N int    `url:"n" json:"n"` // Line number
	T string `url:"t" json:"t"` // Line text

}

type PolicyIn added in v0.0.15

type PolicyIn string

func PtrPolicyIn added in v0.0.15

func PtrPolicyIn(i PolicyIn) *PolicyIn

type PolicyOut added in v0.0.15

type PolicyOut string

func PtrPolicyOut added in v0.0.15

func PtrPolicyOut(i PolicyOut) *PolicyOut

type RefsRequest

type RefsRequest 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
	Type *Type `url:"type,omitempty" json:"type,omitempty"` // Only list references of specified type.
}

type RefsResponse

type RefsResponse struct {
	Name string `url:"name" json:"name"`
	Type Type   `url:"type" json:"type"`

	// The following parameters are optional
	Comment *string `url:"comment,omitempty" json:"comment,omitempty"`
}

type SetOptionsRequest

type SetOptionsRequest 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
	Delete      *string       `url:"delete,omitempty" json:"delete,omitempty"`               // A list of settings you want to delete.
	Dhcp        *util.PVEBool `url:"dhcp,omitempty" json:"dhcp,omitempty"`                   // Enable DHCP.
	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.
	Enable      *util.PVEBool `url:"enable,omitempty" json:"enable,omitempty"`               // Enable/disable firewall rules.
	Ipfilter    *util.PVEBool `url:"ipfilter,omitempty" json:"ipfilter,omitempty"`           // Enable default IP filters. This is equivalent to adding an empty ipfilter-net<id> ipset for every interface. Such ipsets implicitly contain sane default restrictions such as restricting IPv6 link local addresses to the one derived from the interface's MAC address. For containers the configured IP addresses will be implicitly added.
	LogLevelIn  *LogLevelIn   `url:"log_level_in,omitempty" json:"log_level_in,omitempty"`   // Log level for incoming traffic.
	LogLevelOut *LogLevelOut  `url:"log_level_out,omitempty" json:"log_level_out,omitempty"` // Log level for outgoing traffic.
	Macfilter   *util.PVEBool `url:"macfilter,omitempty" json:"macfilter,omitempty"`         // Enable/disable MAC address filter.
	Ndp         *util.PVEBool `url:"ndp,omitempty" json:"ndp,omitempty"`                     // Enable NDP (Neighbor Discovery Protocol).
	PolicyIn    *PolicyIn     `url:"policy_in,omitempty" json:"policy_in,omitempty"`         // Input policy.
	PolicyOut   *PolicyOut    `url:"policy_out,omitempty" json:"policy_out,omitempty"`       // Output policy.
	Radv        *util.PVEBool `url:"radv,omitempty" json:"radv,omitempty"`                   // Allow sending Router Advertisement.
}

type Type added in v0.0.15

type Type string

func PtrType added in v0.0.15

func PtrType(i Type) *Type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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