host

package
v0.0.0-...-d9dd2ce Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StrToMap

func StrToMap(raw string, sep string) map[string]string

Types

type Config

type Config struct {
	Addr       string `json:"addr,omitempty" yaml:"addr"`               // ip加端口
	Username   string `json:"user,omitempty" yaml:"user"`               // 用户名
	Password   string `json:"password,omitempty" yaml:"password"`       // 密码
	PrivateKey string `json:"private_key,omitempty" yaml:"private_key"` // eg: /home/user/.ssh/id_rsa"
	Gssapi     string `json:"gssapi,omitempty" yaml:"gssapi"`           //
}

func (*Config) Valid

func (c *Config) Valid() error

type FetchHost

type FetchHost interface {
	GetHost(domain string) (host Host, ok bool)
	Close() error
}

func New

func New(ctx context.Context, mode string, cfg *Config) (FetchHost, error)

func NewDefault

func NewDefault(ctx context.Context) (FetchHost, error)

func NewHostResolver

func NewHostResolver(ctx context.Context) (FetchHost, error)

func NewLocalDocker

func NewLocalDocker(ctx context.Context) (FetchHost, error)

NewLocalDocker 考虑使用docker api来实现此功能

type Host

type Host string

func (Host) IP

func (d Host) IP() string

IP .

func (Host) Port

func (d Host) Port() string

type SSH

type SSH struct {
	*ssh.Client
	// contains filtered or unexported fields
}

func NewSSH

func NewSSH(ctx context.Context, cfg *Config) (*SSH, error)

func (*SSH) Close

func (s *SSH) Close() error

func (*SSH) GetHost

func (s *SSH) GetHost(domain string) (host Host, ok bool)

Jump to

Keyboard shortcuts

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