From a25fd3c51e6746989925a55bcf6b54fac145d807 Mon Sep 17 00:00:00 2001 From: Riobard Date: Sun, 5 Feb 2017 16:53:02 +0800 Subject: [PATCH] Rename cipher interface --- cipher/doc.go | 8 ++++---- main.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cipher/doc.go b/cipher/doc.go index 22a07faf..a588a133 100644 --- a/cipher/doc.go +++ b/cipher/doc.go @@ -46,8 +46,8 @@ var streamList = map[string]struct { "chacha20-ietf": {32, newChacha20ietf}, } -// ListCiphers returns a list of available cipher names sorted alphabetically. -func ListCiphers() []string { +// List returns a list of available cipher names sorted alphabetically. +func List() []string { var l []string for k := range aeadList { l = append(l, k) @@ -59,8 +59,8 @@ func ListCiphers() []string { return l } -// MakeCipher returns a pair of ciphers for the given key. -func MakeCipher(name string, key []byte) (core.StreamConnCipher, core.PacketConnCipher, error) { +// New returns a pair of ciphers for the given key. +func New(name string, key []byte) (core.StreamConnCipher, core.PacketConnCipher, error) { name = strings.ToLower(name) if choice, ok := aeadList[name]; ok { diff --git a/main.go b/main.go index af75da88..e55e9ecc 100644 --- a/main.go +++ b/main.go @@ -53,7 +53,7 @@ func main() { flag.Parse() if flags.Cipher == "" { - ls := cipher.ListCiphers() + ls := cipher.List() fmt.Fprintf(os.Stderr, "# available ciphers\n") for _, each := range ls { fmt.Fprintf(os.Stderr, "%s\n", each) @@ -66,7 +66,7 @@ func main() { log.Fatalf("key: %v", err) } - streamCipher, packetCipher, err := cipher.MakeCipher(flags.Cipher, key) + streamCipher, packetCipher, err := cipher.New(flags.Cipher, key) if err != nil { log.Fatalf("cipher: %v", err) }