hostsstore

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package hostsstore provides the interface for /var/lib/nerdctl/<ADDRHASH>/etchosts . Prioritize simplicity over scalability.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllocHostsFile

func AllocHostsFile(dataStore, ns, id string) (string, error)

AllocHostsFile is used for creating mount-bindable /etc/hosts file. The file is initialized with no content.

func DeallocHostsFile

func DeallocHostsFile(dataStore, ns, id string) error

func HostsPath

func HostsPath(dataStore, ns, id string) string

HostsPath returns "/var/lib/nerdctl/<ADDRHASH>/etchosts/<NS>/<ID>/hosts"

func ParseHosts added in v0.18.0

func ParseHosts(hostsFileContent []byte, err error) (map[string][]string, error)

ParseHosts takes in hosts file content and returns a map of parsed results. Copy from https://github.com/jaytaylor/go-hostsfile/blob/59e7508e09b9e08c57183ae15eabf1b757328ebf/hosts.go#L18

Types

type Meta

type Meta struct {
	Namespace  string
	ID         string
	Networks   map[string]*types100.Result
	Hostname   string
	ExtraHosts map[string]string // host:ip
	Name       string
}

type Store

type Store interface {
	Acquire(Meta) error
	Release(ns, id string) error
	Update(ns, id, newName string) error
}

func NewStore

func NewStore(dataStore string) (Store, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL