Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultBanner = "# ! MANAGED AUTOMATICALLY !"
DefaultBanner is the default magic comment used to identify entries managed by etchosts
View Source
const DefaultPath = "/etc/hosts"
DefaultPath is the default path used to write hosts entries
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EtcHosts ¶
type EtcHosts struct { // Banner is the magic comment used to identify entries managed by etchosts; if not set, will use DefaultBanner. // It must start with "#" to mark it as a comment. Banner string // Path is the path to the /etc/hosts file; if not set, will use DefaultPath. Path string // Logger is an optional logrus.StdLogger interface, used for debugging. Logger log.StdLogger }
EtcHosts contains the options used to write hosts entries. The zero value can be used to write to DefaultPath using DefaultBanner as a marker.
func (*EtcHosts) WriteEntries ¶
WriteEntries is used to write the hosts entries to EtcHosts.Path Each IP address with their (potentially multiple) hostnames are written to a line marked with EtcHosts.Banner, to avoid overwriting preexisting entries.
Click to show internal directories.
Click to hide internal directories.