forked from helmutkemper/iotmaker.docker.builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuncFindCurrentIPV4Address.go
More file actions
44 lines (41 loc) · 914 Bytes
/
Copy pathfuncFindCurrentIPV4Address.go
File metadata and controls
44 lines (41 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package iotmakerdockerbuilder
import (
"github.com/helmutkemper/util"
)
// FindCurrentIPV4Address
//
// English:
//
// Inspects the docker's network and returns the current IP of the container
//
// Output:
// IP: container IP address IPV4
// err: standard error object
//
// Português:
//
// Inspeciona a rede do docker e devolve o IP atual do container
//
// Saída:
// IP: endereço IP do container IPV4
// err: objeto de erro padrão
func (e *ContainerBuilder) FindCurrentIPV4Address() (IP string, err error) {
var id string
if e.network == nil {
id, err = e.dockerSys.NetworkFindIdByName("bridge")
if err != nil {
util.TraceToLog()
return
}
IP, err = e.findCurrentIPV4AddressSupport(id)
if err != nil {
util.TraceToLog()
}
} else {
IP, err = e.findCurrentIPV4AddressSupport(e.network.GetNetworkID())
if err != nil {
util.TraceToLog()
}
}
return
}