Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsElevated ¶
Types ¶
type HostsSection ¶ added in v0.15.0
type HostsSection struct {
// contains filtered or unexported fields
}
func NewHostsSection ¶ added in v0.15.0
func NewHostsSection(name string) (*HostsSection, error)
func (*HostsSection) Add ¶ added in v0.15.0
func (s *HostsSection) Add(address string, hosts ...string)
Add replaces the entries for address. The hosts are cloned: callers pass a slice they keep using (a tunnel's own host list), and Flush must not be able to reorder it underneath them.
func (*HostsSection) Clear ¶ added in v0.15.0
func (s *HostsSection) Clear()
func (*HostsSection) Flush ¶ added in v0.15.0
func (s *HostsSection) Flush() error
Flush rewrites this section in the hosts file, leaving the rest of it alone.
The read and the write happen under one lock. The catapult and the gateway each own a section of the same file and flush concurrently on their own refresh timers, so reading and writing under separate locks lets the later writer rebuild the file from a snapshot taken before the earlier one landed — reverting the other section, and on shutdown leaving entries behind that point at loopback aliases that no longer exist.
func (*HostsSection) Remove ¶ added in v0.15.0
func (s *HostsSection) Remove(address string)