Documentation ¶
Index ¶
- Constants
- type File
- func (f *File) AddProfile(p *types.Profile) error
- func (f *File) AddRoute(name string, route *types.Route) error
- func (f *File) AddRoutes(name string, routes []*types.Route) error
- func (f *File) Backup(dst string) (string, error)
- func (f *File) Close()
- func (f *File) Disable(profiles []string) error
- func (f *File) DisableAll() error
- func (f *File) DisableOnly(profiles []string) error
- func (f *File) Enable(profiles []string) error
- func (f *File) EnableAll() error
- func (f *File) EnableOnly(profiles []string) error
- func (f *File) Flush() error
- func (f *File) GetDisabled() []string
- func (f *File) GetEnabled() []string
- func (f *File) GetProfile(name string) (*types.Profile, error)
- func (f *File) GetProfileNames() []string
- func (f *File) GetStatus(profiles []string) map[string]types.Status
- func (f *File) List(r types.Renderer, opts *ListOptions)
- func (f *File) MergeFile(from *File)
- func (f *File) MergeProfiles(profiles []*types.Profile)
- func (f *File) ProfileStatus(r types.Renderer, profiles []string)
- func (f *File) RemoveHostnames(name string, routes []string) (bool, error)
- func (f *File) RemoveProfile(name string) error
- func (f *File) RemoveProfiles(profiles []string) error
- func (f *File) ReplaceProfile(p *types.Profile) error
- func (f *File) Restore(from string) error
- func (f *File) Toggle(profiles []string) error
- func (f *File) WriteTo(src string) error
- type ListOptions
Constants ¶
const Banner = `` /* 196-byte string literal not displayed */
Banner is the mark added to hosts file.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File container to handle a hosts file.
func (*File) AddProfile ¶
AddProfile adds a profile to the list.
func (*File) Backup ¶
Backup creates a copy of your hosts file to a new location with the date as extension.
func (*File) Disable ¶
Disable marks profiles as disable by commenting all hosts lines. The content remains on the file and can be enabled later.
func (*File) DisableAll ¶
DisableAll marks all profiles as disable by commenting all hosts lines. The content remains on the file and can be enabled later.
func (*File) DisableOnly ¶
DisableOnly marks profiles as disable and enable all other profiles.
func (*File) Enable ¶
Enable marks profiles as enable by uncommenting all hosts lines making the routing work again.
func (*File) EnableAll ¶
EnableAll marks all profiles as enable by uncommenting all hosts lines making the routing work again.
func (*File) EnableOnly ¶
EnableOnly marks profiles as enable and disable all other profiles.
func (*File) GetDisabled ¶
GetDisabled returns a list of profiles that are Enabled.
func (*File) GetEnabled ¶
GetEnabled returns a list of profiles that are Enabled.
func (*File) GetProfile ¶
GetProfile return a Profile from the list.
func (*File) GetProfileNames ¶
GetProfileNames return a list of all profile names.
func (*File) List ¶
func (f *File) List(r types.Renderer, opts *ListOptions)
List shows a table with profile names status and routing information.
func (*File) MergeProfiles ¶
MergeProfiles joins new profiles with existing content.
func (*File) ProfileStatus ¶
ProfileStatus shows a table only with profile names status.
func (*File) RemoveHostnames ¶
RemoveHostnames removes route information from a given types. also removes the profile if it gets empty.
func (*File) RemoveProfile ¶
RemoveProfile removes given profile from the list.
func (*File) RemoveProfiles ¶
RemoveProfiles removes given profiles from the list.
func (*File) ReplaceProfile ¶
ReplaceProfile removes previous profile with same name and add new profile to the list.