prepare for PR

This commit is contained in:
Nathan Hack 2022-01-01 20:10:53 -05:00
parent ea500d3d6b
commit 250feb7729
6 changed files with 13 additions and 10 deletions

View File

@ -22,7 +22,7 @@ Installing
---------- ----------
``` ```
go get -u github.com/tidwall/redcon go get -u github.com/tidwall/redcon/v2
``` ```
Example Example
@ -52,7 +52,7 @@ import (
"strings" "strings"
"sync" "sync"
"github.com/tidwall/redcon" "github.com/tidwall/redcon/v2"
) )
var addr = ":6380" var addr = ":6380"

View File

@ -1,11 +1,12 @@
package main package main
import ( import (
"context"
"log" "log"
"strings" "strings"
"sync" "sync"
"github.com/nathanhack/redcon" "github.com/tidwall/redcon/v2"
) )
var addr = ":6380" var addr = ":6380"
@ -16,7 +17,7 @@ func main() {
var ps redcon.PubSub var ps redcon.PubSub
go log.Printf("started server at %s", addr) go log.Printf("started server at %s", addr)
err := redcon.ListenAndServe(addr, err := redcon.ListenAndServe(context.Background(), addr,
func(conn redcon.Conn, cmd redcon.Command) { func(conn redcon.Conn, cmd redcon.Command) {
switch strings.ToLower(string(cmd.Args[0])) { switch strings.ToLower(string(cmd.Args[0])) {
default: default:

View File

@ -1,9 +1,10 @@
package main package main
import ( import (
"context"
"log" "log"
"github.com/nathanhack/redcon" "github.com/tidwall/redcon/v2"
) )
var addr = ":6380" var addr = ":6380"
@ -21,7 +22,7 @@ func main() {
mux.HandleFunc("get", handler.get) mux.HandleFunc("get", handler.get)
mux.HandleFunc("del", handler.delete) mux.HandleFunc("del", handler.delete)
err := redcon.ListenAndServe(addr, err := redcon.ListenAndServe(context.Background(), addr,
mux.ServeRESP, mux.ServeRESP,
func(conn redcon.Conn) bool { func(conn redcon.Conn) bool {
// use this function to accept or deny the connection. // use this function to accept or deny the connection.

View File

@ -4,7 +4,7 @@ import (
"log" "log"
"sync" "sync"
"github.com/nathanhack/redcon" "github.com/tidwall/redcon/v2"
) )
type Handler struct { type Handler struct {

View File

@ -1,12 +1,13 @@
package main package main
import ( import (
"context"
"crypto/tls" "crypto/tls"
"log" "log"
"strings" "strings"
"sync" "sync"
"github.com/nathanhack/redcon" "github.com/tidwall/redcon/v2"
) )
const serverKey = `-----BEGIN EC PARAMETERS----- const serverKey = `-----BEGIN EC PARAMETERS-----
@ -47,7 +48,7 @@ func main() {
var items = make(map[string][]byte) var items = make(map[string][]byte)
go log.Printf("started server at %s", addr) go log.Printf("started server at %s", addr)
err = redcon.ListenAndServeTLS(addr, err = redcon.ListenAndServeTLS(context.Background(), addr,
func(conn redcon.Conn, cmd redcon.Command) { func(conn redcon.Conn, cmd redcon.Command) {
switch strings.ToLower(string(cmd.Args[0])) { switch strings.ToLower(string(cmd.Args[0])) {
default: default:

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/nathanhack/redcon/v2 module github.com/tidwall/redcon/v2
go 1.15 go 1.15