github.com/AntonOrnatskyi/goproxy@v0.0.0-20190205095733-4526a9fa18b4/core/dst/util.go (about)

     1  // Copyright 2014 The DST Authors. All rights reserved.
     2  // Use of this source code is governed by an MIT-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package dst
     6  
     7  import (
     8  	logger "log"
     9  	"math/rand"
    10  	"os"
    11  	"time"
    12  )
    13  
    14  var log = logger.New(os.Stderr, "", logger.LstdFlags)
    15  
    16  func SetLogger(l *logger.Logger) {
    17  	log = l
    18  }
    19  func timestampMicros() timestamp {
    20  	return timestamp(time.Now().UnixNano() / 1000)
    21  }
    22  
    23  func randomSeqNo() sequenceNo {
    24  	return sequenceNo(rand.Uint32())
    25  }
    26  
    27  func randomConnID() connectionID {
    28  	return connectionID(rand.Uint32() & 0xffffff)
    29  }