5
5
"io"
6
6
"os"
7
7
8
+ "github.com/fatih/color"
8
9
"github.com/iqhater/myip/data"
9
10
)
10
11
@@ -13,26 +14,26 @@ var out io.Writer = os.Stdout
13
14
14
15
// PrintInternal print all internal ip data
15
16
func PrintInternal (d * data.IPData ) {
16
- fmt .Fprintln (out , "Local interface name:" , d .AdapterName )
17
- fmt .Fprintln (out , "Internal IP:" , d .IntIP )
17
+ color . New ( color . FgMagenta ) .Fprintln (out , "Local interface name:" , d .AdapterName )
18
+ fmt .Fprintln (out , " Internal IP:" , d .IntIP )
18
19
}
19
20
20
21
// PrintExternal print all external ip data
21
22
func PrintExternal (d * data.IPData ) {
22
23
23
24
if d .ExtIP != "" {
24
- fmt . Fprintln (out , "External IP:" , d .ExtIP )
25
+ color . New ( color . FgGreen ). Fprintln (out , " External IP:" , d .ExtIP )
25
26
}
26
27
27
28
if d .Country != "" {
28
- fmt .Fprintln (out , "Country:" , d .Country )
29
+ fmt .Fprintln (out , " Country:" , d .Country )
29
30
}
30
31
31
32
if d .CountryCode != "" {
32
- fmt .Fprintln (out , "Country Code:" , d .CountryCode )
33
+ fmt .Fprintln (out , " Country Code:" , d .CountryCode )
33
34
}
34
35
35
36
if d .Region != "" {
36
- fmt .Fprintln (out , "Region:" , d .Region )
37
+ fmt .Fprintln (out , " Region:" , d .Region )
37
38
}
38
39
}
0 commit comments