Darien Raymond 8 лет назад
Родитель
Сommit
6a90ce3c43

+ 1 - 0
app/proxyman/inbound/worker.go

@@ -135,6 +135,7 @@ func (c *udpConn) Read(buf []byte) (int, error) {
 	return copy(buf, in.Bytes()), nil
 }
 
+// Write implements io.Writer.
 func (c *udpConn) Write(buf []byte) (int, error) {
 	n, err := c.output(buf)
 	if err == nil {

+ 1 - 0
app/proxyman/mux/writer.go

@@ -76,6 +76,7 @@ func (w *Writer) writeData(mb buf.MultiBuffer) error {
 	return w.writer.Write(mb2)
 }
 
+// Write implements buf.MultiBufferWriter.
 func (w *Writer) Write(mb buf.MultiBuffer) error {
 	if mb.IsEmpty() {
 		return w.writeMetaOnly()

+ 1 - 0
common/buf/buffered_writer.go

@@ -19,6 +19,7 @@ func NewBufferedWriter(rawWriter io.Writer) *BufferedWriter {
 	}
 }
 
+// Write implements io.Writer.
 func (v *BufferedWriter) Write(b []byte) (int, error) {
 	if !v.buffered || v.buffer == nil {
 		return v.writer.Write(b)

+ 2 - 0
common/buf/writer.go

@@ -20,6 +20,7 @@ type writerAdapter struct {
 	writer MultiBufferWriter
 }
 
+// Write implements buf.MultiBufferWriter.
 func (w *writerAdapter) Write(mb MultiBuffer) error {
 	_, err := w.writer.WriteMultiBuffer(mb)
 	return err
@@ -65,6 +66,7 @@ type bytesToBufferWriter struct {
 	writer Writer
 }
 
+// Write implements io.Writer.
 func (w *bytesToBufferWriter) Write(payload []byte) (int, error) {
 	mb := NewMultiBuffer()
 	for p := payload; len(p) > 0; {

+ 1 - 0
common/crypto/auth.go

@@ -232,6 +232,7 @@ func NewAuthenticationWriter(auth Authenticator, writer io.Writer, sizeMask Uint
 	}
 }
 
+// Write implements io.Writer.
 func (w *AuthenticationWriter) Write(b []byte) (int, error) {
 	cipherChunk, err := w.auth.Seal(w.buffer[2:2], b)
 	if err != nil {

+ 1 - 0
proxy/shadowsocks/ota.go

@@ -117,6 +117,7 @@ func NewChunkWriter(writer io.Writer, auth *Authenticator) *ChunkWriter {
 	}
 }
 
+// Write implements buf.MultiBufferWriter.
 func (w *ChunkWriter) Write(mb buf.MultiBuffer) error {
 	defer mb.Release()
 

+ 1 - 0
proxy/shadowsocks/protocol.go

@@ -382,6 +382,7 @@ type UDPWriter struct {
 	Request *protocol.RequestHeader
 }
 
+// Write implements io.Writer.
 func (w *UDPWriter) Write(payload []byte) (int, error) {
 	packet, err := EncodeUDPPacket(w.Request, payload)
 	if err != nil {

+ 1 - 0
proxy/socks/protocol.go

@@ -369,6 +369,7 @@ func NewUDPWriter(request *protocol.RequestHeader, writer io.Writer) *UDPWriter
 	}
 }
 
+// Write implements io.Writer.
 func (w *UDPWriter) Write(b []byte) (int, error) {
 	eb := EncodeUDPPacket(w.request, b)
 	defer eb.Release()

+ 1 - 0
transport/internet/headers/http/http.go

@@ -145,6 +145,7 @@ func (c *HttpConn) Read(b []byte) (int, error) {
 	return c.Conn.Read(b)
 }
 
+// Write implements io.Writer.
 func (c *HttpConn) Write(b []byte) (int, error) {
 	if c.oneTimeWriter != nil {
 		err := c.oneTimeWriter.Write(c.Conn)

+ 2 - 0
transport/internet/headers/noop/noop.go

@@ -12,6 +12,8 @@ type NoOpHeader struct{}
 func (NoOpHeader) Size() int {
 	return 0
 }
+
+// Write implements io.Writer.
 func (NoOpHeader) Write([]byte) (int, error) {
 	return 0, nil
 }

+ 1 - 0
transport/internet/headers/srtp/srtp.go

@@ -17,6 +17,7 @@ func (*SRTP) Size() int {
 	return 4
 }
 
+// Write implements io.Writer.
 func (s *SRTP) Write(b []byte) (int, error) {
 	s.number++
 	serial.Uint16ToBytes(s.number, b[:0])

+ 1 - 0
transport/internet/headers/utp/utp.go

@@ -18,6 +18,7 @@ func (*UTP) Size() int {
 	return 4
 }
 
+// Write implements io.Writer.
 func (u *UTP) Write(b []byte) (int, error) {
 	serial.Uint16ToBytes(u.connectionId, b[:0])
 	b[2] = u.header

+ 1 - 0
transport/internet/headers/wechat/wechat.go

@@ -16,6 +16,7 @@ func (vc *VideoChat) Size() int {
 	return 13
 }
 
+// Write implements io.Writer.
 func (vc *VideoChat) Write(b []byte) (int, error) {
 	vc.sn++
 	b = append(b[:0], 0xa1, 0x08)

+ 1 - 0
transport/internet/kcp/connection_test.go

@@ -15,6 +15,7 @@ func (o *NoOpConn) Overhead() int {
 	return 0
 }
 
+// Write implements io.Writer.
 func (o *NoOpConn) Write(b []byte) (int, error) {
 	return len(b), nil
 }

+ 1 - 0
transport/internet/kcp/dialer.go

@@ -38,6 +38,7 @@ func (c *ClientConnection) Overhead() int {
 	return c.writer.Overhead()
 }
 
+// Write implements io.Writer.
 func (c *ClientConnection) Write(b []byte) (int, error) {
 	c.RLock()
 	defer c.RUnlock()

+ 1 - 0
transport/internet/websocket/connection.go

@@ -61,6 +61,7 @@ func (c *connection) getReader() (io.Reader, error) {
 	return reader, nil
 }
 
+// Write implements io.Writer.
 func (c *connection) Write(b []byte) (int, error) {
 	if err := c.wsc.WriteMessage(websocket.BinaryMessage, b); err != nil {
 		return 0, err