Commit b4dc09fcaadb9edfd6c8e222064bb6529919e9a5
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 | 4 | "bufio" |
5 | 5 | "fmt" |
6 | 6 | "io" |
7 | + "io/ioutil" | |
7 | 8 | "log" |
8 | 9 | "os" |
9 | 10 | "os/exec" |
... | ... | @@ -14,7 +15,12 @@ func main() { |
14 | 15 | var out io.Writer |
15 | 16 | |
16 | 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 | 24 | out = os.Stdout |
19 | 25 | } else if l == 2 { |
20 | 26 | host = os.Args[1] | ... | ... |