"strings" "time" ) const ( // api _directoryGetApi = "http://%s/get" _directoryUploadApi = "http://%s/upload" _directoryDelApi = "http://%s/del" _storeGetApi = "http://%s/get" _storeUploadApi = "http://%s/upload" _storeDelApi = "http://%s/del" ) var ( _timer = itime.NewTimer(1024) _transport = &http.Transport{ Dial: func(netw, addr string) (c net.Conn, err error) { if c, err = net.DialTimeout(netw, addr, 2*time.Second); err != nil { return nil, err } return c, nil }, DisableCompression: true, } _client = &http.Client{ Transport: _transport, } _canceler = _transport.CancelRequest // random store node _rand = rand.New(rand.NewSource(time.Now().UnixNano()))
"bufio" "bytes" "errors" "fmt" itime "github.com/Terry-Mao/marmot/time" "io" "net" "net/url" "regexp" "strconv" "sync" "time" ) var ( timer = itime.NewTimer(512) ) // conn is the low-level implementation of Conn type conn struct { // Shared mu sync.Mutex pending int err error conn net.Conn // Read readTimeout time.Duration br *bufio.Reader