Documentation
¶
Index ¶
- type Authentication
- type Authenticator
- type CliSession
- type Debug
- type DeviceBaseInfo
- func (dbi *DeviceBaseInfo) WithAuthPass(auth_pass string) *DeviceBaseInfo
- func (dbi *DeviceBaseInfo) WithMode(mode string) *DeviceBaseInfo
- func (dbi *DeviceBaseInfo) WithSn(sn string) *DeviceBaseInfo
- func (dbi *DeviceBaseInfo) WithSshOptions(ssh_options string) *DeviceBaseInfo
- func (dbi *DeviceBaseInfo) WithTelnet(telnet bool) *DeviceBaseInfo
- func (dbi *DeviceBaseInfo) WithToken(token string) *DeviceBaseInfo
- type HeadBuilder
- type HttpHeader
- type HttpSession
- func (hs *HttpSession) BatchConfig(cmds interface{}, stopOnError bool) error
- func (hs *HttpSession) BatchRun(cmds interface{}, stopOnError bool) error
- func (hs *HttpSession) Client() *http.Client
- func (hs *HttpSession) EnableBasicAuth() *HttpSession
- func (hs *HttpSession) EnableBasicAuthAll() *HttpSession
- func (hs *HttpSession) Request(cmd *command.HttpCmd) (*command.CacheData, error)
- func (hs *HttpSession) RequestWithoutCache(cmd *command.HttpCmd) ([]byte, error)
- func (hs *HttpSession) WithAuthData(data []byte) *HttpSession
- func (hs *HttpSession) WithTokenField(tokenField string) *HttpSession
- type NetconfSession
- type Session
- type SnmpSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶
type Authentication interface {
Auth(hs *HttpSession) (ok bool, token string, err error)
}
type Authenticator ¶
type Authenticator struct{}
func (*Authenticator) Auth ¶
func (au *Authenticator) Auth(hs *HttpSession) (ok bool, token string, err error)
type CliSession ¶
type CliSession struct {
Session
Info *DeviceBaseInfo
OpType terminalmode.ModeType
// contains filtered or unexported fields
}
func NewCliSession ¶
func NewCliSession(info *DeviceBaseInfo) *CliSession
func (*CliSession) BatchConfig ¶
func (cli *CliSession) BatchConfig(cmds interface{}, stopOnError bool) error
func (*CliSession) BatchRun ¶
func (cli *CliSession) BatchRun(cmds interface{}, stopOnError bool) error
func (*CliSession) WithModeType ¶
func (cli *CliSession) WithModeType(opType terminalmode.ModeType)
type Debug ¶
type Debug struct {
DNS struct {
Start string `json:"start"`
End string `json:"end"`
Host string `json:"host"`
Address []net.IPAddr `json:"address"`
Error error `json:"error"`
} `json:"dns"`
Dial struct {
Start string `json:"start"`
End string `json:"end"`
} `json:"dial"`
Connection struct {
Time string `json:"time"`
} `json:"connection"`
WroteAllRequestHeaders struct {
Time string `json:"time"`
} `json:"wrote_all_request_header"`
WroteAllRequest struct {
Time string `json:"time"`
} `json:"wrote_all_request"`
FirstReceivedResponseByte struct {
Time string `json:"time"`
} `json:"first_received_response_byte"`
}
type DeviceBaseInfo ¶
type DeviceBaseInfo struct {
terminal.BaseInfo `json:"base_info" mapstructure:"base_info" yaml:"base_info"`
// Host string `json:"host" mapstructure:"host" yaml:"host"`
// Username string `json:"username" mapstructure:"username" yaml:"username"`
// Password string `json:"password" mapstructure:"password" yaml:"password"`
// AuthPass string `json:"auth_pass" mapstructure:"auth_pass" yaml:"auth_pass"`
// Port int `json:"port" mapstructure:"port" yaml:"port"`
// Authorize bool `json:"authorize" mapstructure:"authorize" yaml:"authorize"`
// SshOptions string `json:"ssh_options" mapstructure:"ssh_options" yaml:"ssh_options"`
Community string `json:"community" mapstructure:"community" yaml:"community"`
Mode string `json:"mode" mapstructure:"mode" yaml:"mode"`
Sn string `json:"sn" mapstructure:"sn" yaml:"sn"`
Token string `json:"token" mapstructure:"token" yaml:"token"`
}
func NewDeviceBaseInfo ¶
func NewDeviceBaseInfo(host, user, pass, devType, community string, port int) *DeviceBaseInfo
func (*DeviceBaseInfo) WithAuthPass ¶
func (dbi *DeviceBaseInfo) WithAuthPass(auth_pass string) *DeviceBaseInfo
func (*DeviceBaseInfo) WithMode ¶
func (dbi *DeviceBaseInfo) WithMode(mode string) *DeviceBaseInfo
func (*DeviceBaseInfo) WithSn ¶
func (dbi *DeviceBaseInfo) WithSn(sn string) *DeviceBaseInfo
func (*DeviceBaseInfo) WithSshOptions ¶
func (dbi *DeviceBaseInfo) WithSshOptions(ssh_options string) *DeviceBaseInfo
func (*DeviceBaseInfo) WithTelnet ¶
func (dbi *DeviceBaseInfo) WithTelnet(telnet bool) *DeviceBaseInfo
func (*DeviceBaseInfo) WithToken ¶
func (dbi *DeviceBaseInfo) WithToken(token string) *DeviceBaseInfo
type HeadBuilder ¶
type HeadBuilder interface {
BuildHeader(hs *HttpSession) (header *http.Header)
}
type HttpHeader ¶
type HttpHeader struct{}
func (*HttpHeader) BuildHeader ¶
func (th *HttpHeader) BuildHeader(hs *HttpSession) (header *http.Header)
type HttpSession ¶
type HttpSession struct {
Session
Info *DeviceBaseInfo
AuthUrl string
TokenId string
TokenTime time.Time
// contains filtered or unexported fields
}
func NewHttpSession ¶
func NewHttpSession(info *DeviceBaseInfo, auth_url string) *HttpSession
func (*HttpSession) BatchConfig ¶
func (hs *HttpSession) BatchConfig(cmds interface{}, stopOnError bool) error
func (*HttpSession) BatchRun ¶
func (hs *HttpSession) BatchRun(cmds interface{}, stopOnError bool) error
func (*HttpSession) Client ¶
func (hs *HttpSession) Client() *http.Client
func (*HttpSession) EnableBasicAuth ¶
func (hs *HttpSession) EnableBasicAuth() *HttpSession
func (*HttpSession) EnableBasicAuthAll ¶
func (hs *HttpSession) EnableBasicAuthAll() *HttpSession
func (*HttpSession) RequestWithoutCache ¶
func (hs *HttpSession) RequestWithoutCache(cmd *command.HttpCmd) ([]byte, error)
func (*HttpSession) WithAuthData ¶
func (hs *HttpSession) WithAuthData(data []byte) *HttpSession
func (*HttpSession) WithTokenField ¶
func (hs *HttpSession) WithTokenField(tokenField string) *HttpSession
type NetconfSession ¶
type NetconfSession struct {
Session
Info *DeviceBaseInfo
// contains filtered or unexported fields
}
func NewNetconfSession ¶
func NewNetconfSession(info *DeviceBaseInfo) *NetconfSession
func (*NetconfSession) Run ¶
func (ns *NetconfSession) Run(cmd *command.NetconfCmd) (*command.CacheData, error)
type SnmpSession ¶
type SnmpSession struct {
Session
Info *DeviceBaseInfo
// contains filtered or unexported fields
}
func NewSnmpSession ¶
func NewSnmpSession(info *DeviceBaseInfo) *SnmpSession
Click to show internal directories.
Click to hide internal directories.