本文整理匯總了Golang中github.com/lxc/lxd/shared.ContainerInfo類的典型用法代碼示例。如果您正苦於以下問題:Golang ContainerInfo類的具體用法?Golang ContainerInfo怎麽用?Golang ContainerInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ContainerInfo類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: PIDColumnData
func (c *listCmd) PIDColumnData(cInfo shared.ContainerInfo, cState *shared.ContainerState, cSnaps []shared.SnapshotInfo) string {
if cInfo.IsActive() && cState != nil {
return fmt.Sprintf("%d", cState.Pid)
}
return ""
}
示例2: IP6ColumnData
func (c *listCmd) IP6ColumnData(cInfo shared.ContainerInfo, cState *shared.ContainerState, cSnaps []shared.SnapshotInfo) string {
if cInfo.IsActive() && cState != nil && cState.Network != nil {
ipv6s := []string{}
for netName, net := range cState.Network {
if net.Type == "loopback" {
continue
}
for _, addr := range net.Addresses {
if shared.StringInSlice(addr.Scope, []string{"link", "local"}) {
continue
}
if addr.Family == "inet6" {
ipv6s = append(ipv6s, fmt.Sprintf("%s (%s)", addr.Address, netName))
}
}
}
return strings.Join(ipv6s, "\n")
} else {
return ""
}
}