common

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: GPL-3.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP() (string, error)

get local ip for test only

func NormalTicker

func NormalTicker(d int) *time.Ticker

func NormalTimeout

func NormalTimeout(d int) *time.Timer

func NormalTimerRelaese

func NormalTimerRelaese(t *time.Timer)

func RandomPort

func RandomPort(min int, max int) int

func RandomTimeout

func RandomTimeout(min int) *time.Timer

func RunCommand

func RunCommand(cmds string, args ...string) (string, error)

Types

type Command

type Command interface {
	Run(string, []string) error
	Scan(string, int) error
	Kill() error
	RunCommand(string, []string) (string, error)
	RunCommandWithTimeout(int, string, []string) (string, error)
}

func NewLinuxCommand

func NewLinuxCommand(log *xlog.Log) Command

func NewMockACommand

func NewMockACommand() Command

func NewMockBCommand

func NewMockBCommand() Command

func NewMockCommand

func NewMockCommand() Command

type LinuxCommand

type LinuxCommand struct {
	// contains filtered or unexported fields
}

a warapper of command

func (*LinuxCommand) Kill

func (c *LinuxCommand) Kill() error

func (*LinuxCommand) Run

func (c *LinuxCommand) Run(cmds string, args []string) error

func (*LinuxCommand) RunCommand

func (c *LinuxCommand) RunCommand(cmds string, args []string) (string, error)

func (*LinuxCommand) RunCommandWithTimeout

func (c *LinuxCommand) RunCommandWithTimeout(timeout int, cmds string, args []string) (string, error)

func (*LinuxCommand) Scan

func (c *LinuxCommand) Scan(substr string, times int) error

scan the substr until times reached or io.EOF got

type MockACommand

type MockACommand struct {
}

mock command

func (*MockACommand) Kill

func (c *MockACommand) Kill() error

func (*MockACommand) Run

func (c *MockACommand) Run(cmds string, args []string) error

func (*MockACommand) RunCommand

func (c *MockACommand) RunCommand(cmds string, args []string) (string, error)

func (*MockACommand) RunCommandWithTimeout

func (c *MockACommand) RunCommandWithTimeout(to int, cmds string, args []string) (string, error)

func (*MockACommand) Scan

func (c *MockACommand) Scan(substr string, times int) error

type MockBCommand

type MockBCommand struct {
}

mock command

func (*MockBCommand) Kill

func (c *MockBCommand) Kill() error

func (*MockBCommand) Run

func (c *MockBCommand) Run(cmds string, args []string) error

func (*MockBCommand) RunCommand

func (c *MockBCommand) RunCommand(cmds string, args []string) (string, error)

func (*MockBCommand) RunCommandWithTimeout

func (c *MockBCommand) RunCommandWithTimeout(to int, cmds string, args []string) (string, error)

func (*MockBCommand) Scan

func (c *MockBCommand) Scan(substr string, times int) error

type MockCommand

type MockCommand struct {
	// contains filtered or unexported fields
}

mock command

func (*MockCommand) Kill

func (c *MockCommand) Kill() error

func (*MockCommand) Run

func (c *MockCommand) Run(cmds string, args []string) error

func (*MockCommand) RunCommand

func (c *MockCommand) RunCommand(cmds string, args []string) (string, error)

func (*MockCommand) RunCommandWithTimeout

func (c *MockCommand) RunCommandWithTimeout(to int, cmds string, args []string) (string, error)

func (*MockCommand) Scan

func (c *MockCommand) Scan(substr string, times int) error

Jump to

Keyboard shortcuts

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