Commit b4dc09fcaadb9edfd6c8e222064bb6529919e9a5

Authored by 김태훈
1 parent 6db1fd7817
Exists in master

호스트 주소 기본 값을 파일로 지정 가능

Showing 1 changed file with 7 additions and 1 deletions   Show diff stats
go/src/fullcycle/do-iperf/main.go
@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 "bufio" 4 "bufio"
5 "fmt" 5 "fmt"
6 "io" 6 "io"
  7 + "io/ioutil"
7 "log" 8 "log"
8 "os" 9 "os"
9 "os/exec" 10 "os/exec"
@@ -14,7 +15,12 @@ func main() { @@ -14,7 +15,12 @@ func main() {
14 var out io.Writer 15 var out io.Writer
15 16
16 if l := len(os.Args); l == 1 { 17 if l := len(os.Args); l == 1 {
17 - host = "172.30.0.1" 18 + b, err := ioutil.ReadFile("host.iperf")
  19 + if err != nil {
  20 + host = "172.30.0.1"
  21 + } else {
  22 + host = string(b)
  23 + }
18 out = os.Stdout 24 out = os.Stdout
19 } else if l == 2 { 25 } else if l == 2 {
20 host = os.Args[1] 26 host = os.Args[1]