diff --git a/proxy/.idea/.gitignore b/proxy/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/proxy/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/proxy/.idea/modules.xml b/proxy/.idea/modules.xml new file mode 100644 index 0000000..e8e9535 --- /dev/null +++ b/proxy/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/proxy/.idea/proxy.iml b/proxy/.idea/proxy.iml new file mode 100644 index 0000000..79e6b7e --- /dev/null +++ b/proxy/.idea/proxy.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/proxy/.idea/remote-targets.xml b/proxy/.idea/remote-targets.xml new file mode 100644 index 0000000..e5de6e6 --- /dev/null +++ b/proxy/.idea/remote-targets.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/proxy/.idea/vcs.xml b/proxy/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/proxy/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/proxy/proxy b/proxy/proxy new file mode 100644 index 0000000..358b180 Binary files /dev/null and b/proxy/proxy differ diff --git a/proxy/proxy.go b/proxy/proxy.go new file mode 100644 index 0000000..a8e49e9 --- /dev/null +++ b/proxy/proxy.go @@ -0,0 +1,25 @@ +package main + +import ( + "bytes" + "fmt" + "io" + "log" + "os" + "os/exec" +) + +func main() { + cmd := exec.Command("ping", "127.0.0.1", "-c 10") + + var stdoutBuf, stderrBuf bytes.Buffer + cmd.Stdout = io.MultiWriter(os.Stdout, &stdoutBuf) + cmd.Stderr = io.MultiWriter(os.Stderr, &stderrBuf) + + err := cmd.Run() + if err != nil { + log.Fatalf("cmd.Run() failed with %s\n", err) + } + outStr, errStr := string(stdoutBuf.Bytes()), string(stderrBuf.Bytes()) + fmt.Printf("\nout:\n%s\nerr:\n%s\n", outStr, errStr) +} \ No newline at end of file