]> Cypherpunks.ru repositories - netstring.git/blobdiff - netstring.go
Refactoring, io.Reader/Writer friendliness, performance optimization
[netstring.git] / netstring.go
diff --git a/netstring.go b/netstring.go
deleted file mode 100644 (file)
index 8345556..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-netstring -- netstring format serialization library
-Copyright (C) 2015-2020 Sergey Matveev <stargrave@stargrave.org>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, version 3 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-// netstring format serialization library.
-//
-// This is implementation of netstring
-// (http://cr.yp.to/proto/netstrings.txt) format for binary string
-// serialization.
-//
-//   buf := bytes.NewBuffer(nil)
-//   w := netstring.NewWriter(buf)
-//   w.Write([]byte("hello")) // buf contains "5:hello,"
-//   w.Write([]byte("world!")) // buf contains "5:hello,6:world!,"
-//   r := netstring.NewReader(buf)
-//   size, err := r.Iter() // size is 5
-//   r.Discard() // discard (skip) current netstring ("hello")
-//   size, err = r.Iter() // size is 6
-//   out := make([]byte, size)
-//   r.Read(out) // out contains "world!" bytes
-//
-// Pay attention that netstring uses bufio for Reader and Writer.
-package netstring
-
-import (
-       "errors"
-)
-
-const (
-       MaxPrefixSize = 21
-)
-
-var (
-       ErrBufSize    error = errors.New("Invalid destination buffer size")
-       ErrState      error = errors.New("Invalid state")
-       ErrTerminator error = errors.New("Invalid terminator")
-)