mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-03 07:56:42 -05:00
clean lint warnings
This commit is contained in:
parent
7a97d73737
commit
bf7906c7f0
@ -118,7 +118,7 @@ func getDefaultPoolSize() uint32 {
|
||||
}
|
||||
|
||||
func init() {
|
||||
var size uint32 = getDefaultPoolSize()
|
||||
size := getDefaultPoolSize()
|
||||
sizeStr := os.Getenv(poolSizeEnvKey)
|
||||
if len(sizeStr) > 0 {
|
||||
customSize, err := strconv.ParseUint(sizeStr, 10, 32)
|
||||
|
@ -11,7 +11,7 @@ type BufferedReader struct {
|
||||
buffered bool
|
||||
}
|
||||
|
||||
// NewReader creates a new BufferedReader based on an io.Reader.
|
||||
// NewBufferedReader creates a new BufferedReader based on an io.Reader.
|
||||
func NewBufferedReader(rawReader io.Reader) *BufferedReader {
|
||||
return &BufferedReader{
|
||||
reader: rawReader,
|
||||
|
@ -14,7 +14,7 @@ type BufferedWriter struct {
|
||||
buffered bool
|
||||
}
|
||||
|
||||
// NewWriter creates a new BufferedWriter.
|
||||
// NewBufferedWriter creates a new BufferedWriter.
|
||||
func NewBufferedWriter(rawWriter io.Writer) *BufferedWriter {
|
||||
return &BufferedWriter{
|
||||
writer: rawWriter,
|
||||
|
@ -24,7 +24,7 @@ func TestBufferedWriter(t *testing.T) {
|
||||
|
||||
assert.Bool(content.IsEmpty()).IsTrue()
|
||||
|
||||
writer.SetBuffered(false)
|
||||
assert.Error(writer.SetBuffered(false)).IsNil()
|
||||
assert.Int(content.Len()).Equals(16)
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ func NewReader(reader io.Reader) Reader {
|
||||
|
||||
// ToBytesReader converts a Reaaer to io.Reader.
|
||||
func ToBytesReader(stream Reader) io.Reader {
|
||||
return &BufferToBytesReader{
|
||||
return &bufferToBytesReader{
|
||||
stream: stream,
|
||||
}
|
||||
}
|
||||
@ -90,7 +90,7 @@ func NewWriter(writer io.Writer) Writer {
|
||||
|
||||
// ToBytesWriter converts a Writer to io.Writer
|
||||
func ToBytesWriter(writer Writer) io.Writer {
|
||||
return &BytesToBufferWriter{
|
||||
return &bytesToBufferWriter{
|
||||
writer: writer,
|
||||
}
|
||||
}
|
||||
|
@ -43,15 +43,14 @@ func (v *BytesToBufferReader) Read() (*Buffer, error) {
|
||||
return buffer, nil
|
||||
}
|
||||
|
||||
type BufferToBytesReader struct {
|
||||
type bufferToBytesReader struct {
|
||||
stream Reader
|
||||
current *Buffer
|
||||
err error
|
||||
}
|
||||
|
||||
// Fill fills in the internal buffer.
|
||||
// Private: Visible for testing.
|
||||
func (v *BufferToBytesReader) Fill() {
|
||||
// fill fills in the internal buffer.
|
||||
func (v *bufferToBytesReader) fill() {
|
||||
b, err := v.stream.Read()
|
||||
v.current = b
|
||||
if err != nil {
|
||||
@ -60,13 +59,13 @@ func (v *BufferToBytesReader) Fill() {
|
||||
}
|
||||
}
|
||||
|
||||
func (v *BufferToBytesReader) Read(b []byte) (int, error) {
|
||||
func (v *bufferToBytesReader) Read(b []byte) (int, error) {
|
||||
if v.err != nil {
|
||||
return 0, v.err
|
||||
}
|
||||
|
||||
if v.current == nil {
|
||||
v.Fill()
|
||||
v.fill()
|
||||
if v.err != nil {
|
||||
return 0, v.err
|
||||
}
|
||||
|
@ -23,11 +23,11 @@ func (v *BufferToBytesWriter) Write(buffer *Buffer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type BytesToBufferWriter struct {
|
||||
type bytesToBufferWriter struct {
|
||||
writer Writer
|
||||
}
|
||||
|
||||
func (v *BytesToBufferWriter) Write(payload []byte) (int, error) {
|
||||
func (v *bytesToBufferWriter) Write(payload []byte) (int, error) {
|
||||
bytesWritten := 0
|
||||
size := len(payload)
|
||||
for size > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user