File: encoding.go

package info (click to toggle)
golang-github-anacrolix-missinggo 2.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 836 kB
  • sloc: makefile: 4
file content (15 lines) | stat: -rw-r--r-- 439 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package missinggo

// An interface for "encoding/base64".Encoder
type Encoding interface {
	EncodeToString([]byte) string
	DecodeString(string) ([]byte, error)
}

// An encoding that does nothing.
type IdentityEncoding struct{}

var _ Encoding = IdentityEncoding{}

func (IdentityEncoding) EncodeToString(b []byte) string        { return string(b) }
func (IdentityEncoding) DecodeString(s string) ([]byte, error) { return []byte(s), nil }