README ¶
etc-hosts-editor
Utility for managing the OS /etc/hosts file.
INSTALLATION
> go install github.com/go-coreutils/etc-hosts-editor/cmd/eheditor@latest
DOCUMENTATION
> eheditor --help
NAME:
eheditor - etc hosts editor
USAGE:
eheditor [options] [/etc/hosts]
VERSION:
v0.8.0 (trunk)
DESCRIPTION:
command line utility for managing the OS /etc/hosts file
GLOBAL OPTIONS:
--read-only, -r do not write any changes to the etc hosts file
--help, -h, --usage display command-line usage information
--version, -v display the version
LICENSE
Copyright 2024 The Go-CoreUtils Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use file except in compliance with the License.
You may obtain a copy of the license at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Documentation ¶
Index ¶
- Variables
- type Host
- func (h *Host) Active() bool
- func (h *Host) AddDomain(domain string)
- func (h *Host) Address() string
- func (h *Host) AppendComment(text string)
- func (h *Host) Block() string
- func (h *Host) Changed() bool
- func (h *Host) Comment() string
- func (h *Host) Domains() []string
- func (h *Host) Empty() bool
- func (h *Host) Equals(host *Host) bool
- func (h *Host) GetActualInfo() (label, tooltip string)
- func (h *Host) HasDomain(needle string) (found bool)
- func (h *Host) Importance() HostImportance
- func (h *Host) IsComment() bool
- func (h *Host) IsOnlyComment() (onlyComment bool)
- func (h *Host) Line() string
- func (h *Host) Lookup() string
- func (h *Host) Name() (ipOrName string)
- func (h *Host) PerformLookup() (found []net.IP, err error)
- func (h *Host) RemoveDomain(domain string)
- func (h *Host) SetActive(active bool)
- func (h *Host) SetAddress(value string)
- func (h *Host) SetComment(text string)
- func (h *Host) SetDomains(text string)
- func (h *Host) SetLookup(value string)
- func (h *Host) String() string
- type HostImportance
- type HostInfo
- type Hostfile
- func (eh *Hostfile) Hosts() []*Host
- func (eh *Hostfile) IndexOf(host *Host) int
- func (eh *Hostfile) InsertHost(host *Host, idx int)
- func (eh *Hostfile) Len() int
- func (eh *Hostfile) MoveHost(from, to int)
- func (eh *Hostfile) RemoveHost(idx int)
- func (eh *Hostfile) Save() (err error)
- func (eh *Hostfile) Validate() (errs []error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
HostValidations = map[string]string{
"localhost": "IPv4 (localhost)",
"ip6-localhost": "IPv6 (localhost)",
"ip6-loopback": "IPv6 (loopback)",
"ip6-allnodes": "IPv6 (all nodes)",
"ip6-allrouters": "IPv6 (all routers)",
}
)
Functions ¶
This section is empty.
Types ¶
type Host ¶
func NewComment ¶
func NewHostFromInfo ¶
func (*Host) AppendComment ¶
func (*Host) GetActualInfo ¶
func (*Host) Importance ¶
func (h *Host) Importance() HostImportance
func (*Host) IsOnlyComment ¶
func (*Host) RemoveDomain ¶
func (*Host) SetAddress ¶
func (*Host) SetComment ¶
func (*Host) SetDomains ¶
type HostImportance ¶
type HostImportance string
const ( HostNotImportant HostImportance = "none" HostIsLocalhostIPv4 HostImportance = "ipv4" HostIsLocalhostIPv6 HostImportance = "ipv6" )
type HostInfo ¶
type HostInfo struct {
// contains filtered or unexported fields
}
func (HostInfo) SameHostInfo ¶
type Hostfile ¶
type Hostfile struct { Path string Comment string sync.RWMutex // contains filtered or unexported fields }
func (*Hostfile) InsertHost ¶
func (*Hostfile) RemoveHost ¶
Click to show internal directories.
Click to hide internal directories.