本文整理汇总了Golang中github.com/petar/GoTeleport/tele/trace.Frame.Printf方法的典型用法代码示例。如果您正苦于以下问题:Golang Frame.Printf方法的具体用法?Golang Frame.Printf怎么用?Golang Frame.Printf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/petar/GoTeleport/tele/trace.Frame
的用法示例。
在下文中一共展示了Frame.Printf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewRandomUnreliableTransport
func NewRandomUnreliableTransport(f trace.Frame, nok, ndrop int, expa, expb time.Duration) *Transport {
return NewTransport(f, func(f0, f1 trace.Frame, a0, a1 net.Addr) (net.Conn, net.Conn) {
nok, ndrop := rand.Intn(nok+1), rand.Intn(ndrop+1)
nok = max(nok, 1)
f.Printf("TRANSPORT PROFILE NOK=%d, NDROP=%d", nok, ndrop)
return NewSievePipe(f0, f1, a0, a1, nok, ndrop, expa, expb)
})
}
示例2: testWrite
func testWrite(fr trace.Frame, t *testing.T, c *Conn, ready chan<- int) {
defer func() {
ready <- 1
}()
for i := 0; i < N; i++ {
if err := c.Write([]byte{byte(i), byte(i + 1), byte(i + 2)}); err != nil {
t.Errorf("write (%s)", err)
failNow()
}
fr.Printf("WROTE %d/%d", i+1, N)
}
if err := c.Close(); err != nil {
t.Fatalf("write-side close (%s)", err)
failNow()
}
fr.Printf("CLOSED WRITE")
}
示例3: testRead
func testRead(fr trace.Frame, t *testing.T, c *Conn, ready chan<- int) {
defer func() {
ready <- 1
}()
for i := 0; i < N; i++ {
q, err := c.Read()
if err != nil {
t.Fatalf("read (%s)", err)
failNow()
}
z := []byte{byte(i), byte(i + 1), byte(i + 2)}
if !reflect.DeepEqual(q, z) {
t.Fatalf("expecting %#v, got %#v", z, q)
failNow()
}
fr.Printf("READ %d/%d", i+1, N)
}
if err := c.Close(); err != nil {
t.Fatalf("read-side close (%s)", err)
failNow()
}
fr.Printf("CLOSED READ")
}
示例4: NewUnreliableTransport
func NewUnreliableTransport(f trace.Frame, nok, ndrop int, expa, expb time.Duration) *Transport {
return NewTransport(f, func(f0, f1 trace.Frame, a0, a1 net.Addr) (net.Conn, net.Conn) {
f.Printf("TRANSPORT PROFILE NOK=%d, NDROP=%d", nok, ndrop)
return NewSievePipe(f0, f1, a0, a1, nok, ndrop, expa, expb)
})
}