本文整理匯總了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)
})
}