Documentation
¶
Index ¶
- func Flush(hostFilePath string, mappings []*Mapping) error
- func GetSysHostFilePath() (string, error)
- type HostManager
- func (h *HostManager) Backup(backupHostFilePath string) error
- func (h *HostManager) DeleteHost(host string) error
- func (h *HostManager) Duplicate(newHostFilePath string) (*HostManager, error)
- func (h *HostManager) HostFilePath() string
- func (h *HostManager) LookupByAddress(address string) (*Mapping, bool)
- func (h *HostManager) LookupByHost(host string) (*Mapping, bool)
- func (h *HostManager) Mappings() []*Mapping
- func (h *HostManager) Set(host, address, comment string) error
- func (h *HostManager) String() string
- type Mapping
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSysHostFilePath ¶
Types ¶
type HostManager ¶
type HostManager struct {
// contains filtered or unexported fields
}
func Default ¶
func Default() (*HostManager, error)
Default returns a `*HostManager` with system host file path.
func New ¶
func New(hostFilePath string) (*HostManager, error)
New returns a `*HostManager` with given host file path.
func (*HostManager) Backup ¶
func (h *HostManager) Backup(backupHostFilePath string) error
func (*HostManager) DeleteHost ¶
func (h *HostManager) DeleteHost(host string) error
func (*HostManager) Duplicate ¶
func (h *HostManager) Duplicate(newHostFilePath string) (*HostManager, error)
func (*HostManager) HostFilePath ¶
func (h *HostManager) HostFilePath() string
func (*HostManager) LookupByAddress ¶
func (h *HostManager) LookupByAddress(address string) (*Mapping, bool)
func (*HostManager) LookupByHost ¶
func (h *HostManager) LookupByHost(host string) (*Mapping, bool)
func (*HostManager) Mappings ¶
func (h *HostManager) Mappings() []*Mapping
func (*HostManager) Set ¶
func (h *HostManager) Set(host, address, comment string) error
Set set the ip of host as address, and flush to host file.
func (*HostManager) String ¶
func (h *HostManager) String() string
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
hoster
command
|
|
|
examples
|
|
|
e1-new-host-manager
command
|
|
|
e2-lookup
command
|
|
|
e3-set-and-delete
command
|
|
|
e4-backup
command
|
|
|
pkg
|
|
Click to show internal directories.
Click to hide internal directories.