本文整理匯總了Golang中github.com/docker/libnetwork.Endpoint.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang Endpoint.Name方法的具體用法?Golang Endpoint.Name怎麽用?Golang Endpoint.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/docker/libnetwork.Endpoint
的用法示例。
在下文中一共展示了Endpoint.Name方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: buildEndpointResource
func buildEndpointResource(e libnetwork.Endpoint) types.EndpointResource {
er := types.EndpointResource{}
if e == nil {
return er
}
er.EndpointID = e.ID()
er.Name = e.Name()
ei := e.Info()
if ei == nil {
return er
}
if iface := ei.Iface(); iface != nil {
if mac := iface.MacAddress(); mac != nil {
er.MacAddress = mac.String()
}
if ip := iface.Address(); ip != nil && len(ip.IP) > 0 {
er.IPv4Address = ip.String()
}
if ipv6 := iface.AddressIPv6(); ipv6 != nil && len(ipv6.IP) > 0 {
er.IPv6Address = ipv6.String()
}
}
return er
}
示例2: buildEndpointResource
func buildEndpointResource(ep libnetwork.Endpoint) *endpointResource {
r := &endpointResource{}
if ep != nil {
r.Name = ep.Name()
r.ID = ep.ID()
r.Network = ep.Network()
}
return r
}
示例3: buildEndpointResource
func buildEndpointResource(ep libnetwork.Endpoint) *endpointResource {
r := &endpointResource{}
var iplist []string
if ep != nil {
r.Name = ep.Name()
r.ID = ep.ID()
r.Network = ep.Network()
// Build a list of ip addrs on this endpoint.
for _, iface := range ep.Info().InterfaceList() {
if iface.Address().IP != nil && len(iface.Address().IP) > 0 {
ip := iface.Address().IP.String()
iplist = append(iplist, ip)
}
}
r.InterfaceList = iplist
}
return r
}