Documentation
¶
Overview ¶
Package firewall wraps the DigitalOcean Cloud Firewalls API.
Index ¶
- type CreateOptions
- type RuleSpec
- type Service
- func (s *Service) AddInboundRules(ctx context.Context, id string, rules []RuleSpec) error
- func (s *Service) AddOutboundRules(ctx context.Context, id string, rules []RuleSpec) error
- func (s *Service) AttachDroplets(ctx context.Context, id string, dropletIDs ...int) error
- func (s *Service) Create(ctx context.Context, opts CreateOptions) (*godo.Firewall, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) DetachDroplets(ctx context.Context, id string, dropletIDs ...int) error
- func (s *Service) Get(ctx context.Context, id string) (*godo.Firewall, error)
- func (s *Service) List(ctx context.Context) ([]godo.Firewall, error)
- func (s *Service) ListByDroplet(ctx context.Context, dropletID int) ([]godo.Firewall, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateOptions ¶
type CreateOptions struct {
Name string
InboundRules []RuleSpec
OutboundRules []RuleSpec
DropletIDs []int
Tags []string
}
CreateOptions holds parameters for creating a firewall.
type RuleSpec ¶
type RuleSpec struct {
Protocol string
PortRange string
Addresses []string // "any" expands to "0.0.0.0/0,::/0"
}
RuleSpec is a human-friendly rule definition. Format: "proto:ports:addresses" Examples:
"tcp:443:any" -> allow TCP 443 from anywhere "tcp:22:203.0.113.1" -> allow TCP 22 from a specific IP "tcp:8080-8090:10.0.0.0/8" -> allow TCP range from CIDR "icmp:0:any" -> allow ICMP from anywhere
func ParseRuleSpec ¶
ParseRuleSpec parses a "proto:ports:addr1,addr2" string into a RuleSpec.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service exposes firewall operations against the DigitalOcean API.
func (*Service) AddInboundRules ¶
AddInboundRules appends inbound rules to an existing firewall.
func (*Service) AddOutboundRules ¶
AddOutboundRules appends outbound rules to an existing firewall.
func (*Service) AttachDroplets ¶
AttachDroplets adds Droplet IDs to an existing firewall.
func (*Service) DetachDroplets ¶
DetachDroplets removes Droplet IDs from an existing firewall.
Click to show internal directories.
Click to hide internal directories.