本文整理匯總了Golang中github.com/cortesi/devd/inject.Injector.Copy方法的典型用法代碼示例。如果您正苦於以下問題:Golang Injector.Copy方法的具體用法?Golang Injector.Copy怎麽用?Golang Injector.Copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cortesi/devd/inject.Injector
的用法示例。
在下文中一共展示了Injector.Copy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: copyResponse
func (p *ReverseProxy) copyResponse(dst io.Writer, inject *inject.Injector) {
if p.FlushInterval != 0 {
if wf, ok := dst.(writeFlusher); ok {
mlw := &maxLatencyWriter{
dst: wf,
latency: p.FlushInterval,
done: make(chan bool),
}
go mlw.flushLoop()
defer mlw.stop()
dst = mlw
}
}
inject.Copy(dst)
}
示例2: copyResponse
func (p *ReverseProxy) copyResponse(ctx context.Context, dst io.Writer, inject *inject.Injector) {
log := termlog.FromContext(ctx)
if p.FlushInterval != 0 {
if wf, ok := dst.(writeFlusher); ok {
mlw := &maxLatencyWriter{
dst: wf,
latency: p.FlushInterval,
done: make(chan bool),
}
go mlw.flushLoop()
defer mlw.stop()
dst = mlw
}
}
_, err := inject.Copy(dst)
if err != nil {
log.Shout("Error forwarding data: %s", err)
}
}