Documentation ¶
Overview ¶
* @author: mojtaba.eskandari@waziup.org Nov 25th 2019 * @A deamon to execute commands on host
Index ¶
- func ExecCommand(cmd string, withLogs bool) (out string, err error)
- func GetIPAddr() string
- func GetMACAddr() (addr string)
- func ReadAll(rc io.ReadCloser) ([]byte, error)
- func SendJSON(resp http.ResponseWriter, obj interface{})
- func SendPlainResponse(resp http.ResponseWriter, plain_response string)
- func ServeHost()
- func SetRequestBody(req *http.Request, body interface{})
- func Shell(dir string, sh string) (string, error)
- func SockDeleteReqest(API string) ([]byte, error)
- func SockGetRequest(API string) ([]byte, error)
- func SockPostReqest(socketAddr string, API string, postValues string) ([]byte, error)
- func SocketReqest(url string, method string, contentType string, body io.Reader) (*http.Response, error)
- func Untar(dst string, r io.Reader) error
- type ClosingBuffer
- type RequestBodyContextKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIPAddr ¶
func GetIPAddr() string
GetIPAddr returns the non loopback local IP of the container
func GetMACAddr ¶
func GetMACAddr() (addr string)
GetMACAddr gets the MAC hardware address of the host machine from https://gist.github.com/rucuriousyet/ab2ab3dc1a339de612e162512be39283
func SendJSON ¶
func SendJSON(resp http.ResponseWriter, obj interface{})
func SendPlainResponse ¶
func SendPlainResponse(resp http.ResponseWriter, plain_response string)
func SetRequestBody ¶
func SockDeleteReqest ¶
SockDeleteReqest makes a DELETE request to a unix socket ex: SockDeleteReqest( "/var/run/wazigate-host.sock", "containers/waziup.wazigate-test")
func SockGetRequest ¶
SockGetRequest makes a GET request to a unix socket ex: SockGetRequest( "/var/run/wazigate-host.sock", "/")
func SockPostReqest ¶
SockPostReqest makes a POST request to a unix socket ex (post Request): SockPostReqest( "/var/run/wazigate-host.sock", "cmd", "ls -a")
Types ¶
type ClosingBuffer ¶
func (*ClosingBuffer) Close ¶
func (cb *ClosingBuffer) Close() error
type RequestBodyContextKey ¶
type RequestBodyContextKey struct{}