package etchosts
import "github.com/docker/docker/libnetwork/etchosts"
Index ¶
- func Add(path string, recs []Record) error
- func Build(path string, extraContent []Record) error
- func BuildNoIPv6(path string, extraContent []Record) error
- func Delete(path string, recs []Record) error
- func Drop(path string)
- func Update(path, IP, hostname string) error
- type Record
Functions ¶
func Add ¶
Add adds an arbitrary number of Records to an already existing /etc/hosts file
func Build ¶
Build function path is path to host file string required extraContent is an array of extra host records.
func BuildNoIPv6 ¶
BuildNoIPv6 is the same as Build, but will not include IPv6 entries.
func Delete ¶
Delete deletes Records from /etc/hosts. The hostnames must be an exact match (if the user has modified the record, it won't be deleted). The address, parsed as a netip.Addr must also match the value in recs.
func Drop ¶
func Drop(path string)
Drop drops the path string from the path cache
func Update ¶
Update all IP addresses where hostname matches. path is path to host file IP is new IP address hostname is hostname to search for to replace IP
Types ¶
type Record ¶
Record Structure for a single host record
func (Record) WriteTo ¶
WriteTo writes record to file and returns bytes written or error
Source Files ¶
- Version
- v28.0.0-rc.1+incompatible
- Published
- Feb 6, 2025
- Platform
- js/wasm
- Imports
- 9 packages
- Last checked
- 10 minutes ago –
Tools for package owners.