本文整理匯總了Golang中github.com/cloudfoundry-incubator/garden-linux/linux_container.LinuxContainer.NetIn方法的典型用法代碼示例。如果您正苦於以下問題:Golang LinuxContainer.NetIn方法的具體用法?Golang LinuxContainer.NetIn怎麽用?Golang LinuxContainer.NetIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry-incubator/garden-linux/linux_container.LinuxContainer
的用法示例。
在下文中一共展示了LinuxContainer.NetIn方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
}, func(*exec.Cmd) error {
return disaster
},
)
})
It("returns the error", func() {
_, err := container.StreamOut(garden.StreamOutSpec{User: "alice", Path: "/some/dst"})
Expect(err).To(Equal(disaster))
})
})
})
Describe("Net in", func() {
It("executes net.sh in with HOST_PORT and CONTAINER_PORT", func() {
hostPort, containerPort, err := container.NetIn(123, 456)
Expect(err).ToNot(HaveOccurred())
Expect(fakeRunner).To(HaveExecutedSerially(
fake_command_runner.CommandSpec{
Path: containerDir + "/net.sh",
Args: []string{"in"},
Env: []string{
"HOST_PORT=123",
"CONTAINER_PORT=456",
"PATH=" + os.Getenv("PATH"),
},
},
))
Expect(hostPort).To(Equal(uint32(123)))
示例2:
bandwidthLimits := garden.BandwidthLimits{
RateInBytesPerSecond: 1,
BurstRateInBytesPerSecond: 2,
}
cpuLimits := garden.CPULimits{
LimitInShares: 1,
}
JustBeforeEach(func() {
var err error
err = container.Start()
Expect(err).ToNot(HaveOccurred())
_, _, err = container.NetIn(1, 2)
Expect(err).ToNot(HaveOccurred())
_, _, err = container.NetIn(3, 4)
Expect(err).ToNot(HaveOccurred())
container.NetOut(netOutRule1)
container.NetOut(netOutRule2)
p1 := new(wfakes.FakeProcess)
p1.IDReturns("1")
p2 := new(wfakes.FakeProcess)
p2.IDReturns("2")
p3 := new(wfakes.FakeProcess)