Documentation ¶
Overview ¶
The restore package provides data structures important to restoring DNS proxy rules. This package serves as a central source for these structures. Note that these are marshaled as JSON and any changes need to be compatible across an upgrade!
Index ¶
Constants ¶
const PortProtoV2 = 1 << 24
PortProtoV2 is 1 value at bit position 24.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPRule ¶
type IPRule struct { Re RuleRegex IPs map[string]struct{} // IPs, nil set is wildcard and allows all IPs! }
IPRule stores the allowed destination IPs for a DNS names matching a regex
type PortProto ¶ added in v1.13.15
type PortProto uint32
PortProto is uint32 that encodes two different versions of port protocol keys. Version 1 is protocol agnostic and (naturally) encodes no values at bit positions 16-31. Version 2 encodes protocol at bit positions 16-23, and bit position 24 encodes a 1 value to indicate that it is Version 2. Both versions encode the port at the bit positions 0-15.
This works because Version 1 will naturally encode no values at postions 16-31 as the original Version 1 was a uint16. Version 2 enforces a 1 value at the 24th bit position, so it will alway be legible.
func MakeV2PortProto ¶ added in v1.13.15
MakeV2PortProto returns a Version 2 port protocol.
func (PortProto) Protocol ¶ added in v1.13.15
Protocol returns the protocol of the PortProto. It returns "0" for Version 1.
type RuleRegex ¶
type RuleRegex struct {
Pattern *string
}
RuleRegex is a wrapper for a pointer to a string so that we can define marshalers for it.
func (RuleRegex) MarshalText ¶
MarshalText marshals RuleRegex as string
func (*RuleRegex) UnmarshalText ¶
UnmarshalText unmarshals json into a RuleRegex This must have a pointer receiver, otherwise the RuleRegex remains empty.