代码拉取完成,页面将自动刷新
package event
import (
"context"
"time"
)
type BootClient struct {
*Event
ctx context.Context
cancel context.CancelFunc
}
func NewBootClient() *BootClient {
return &BootClient{Event: NewEvent()}
}
func NewBootClientContext(ctx context.Context) *BootClient {
return &BootClient{ctx: ctx}
}
func (b *BootClient) CancelFunc() {
if b.cancel != nil {
b.cancel()
}
}
func (b *BootClient) Dial(network string, addr string) (StarterClient, error) {
return b.DialTimeout(network, addr, time.Second*30)
}
func (b *BootClient) DialTimeout(network string, addr string, timeout time.Duration) (StarterClient, error) {
client := newStarterClient(network, b.Event, b.ctx)
if _, err := client.DialTimeout(addr, timeout); err != nil {
return nil, err
}
return client, nil
}
func (b *BootClient) DialTcp(addr string) (StarterClient, error) {
return b.DialTimeout("tcp", addr, time.Second*30)
}
func (b *BootClient) DialTcpTimeout(addr string, timeout time.Duration) (StarterClient, error) {
return b.DialTimeout("tcp", addr, timeout)
}
func (b *BootClient) DialUdp(addr string) (StarterClient, error) {
return b.DialTimeout("udp", addr, time.Second*30)
}
func (b *BootClient) DialUdpTimeout(addr string, timeout time.Duration) (StarterClient, error) {
return b.DialTimeout("udp", addr, timeout)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。