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
@ -52,7 +52,7 @@ import (
"strings"
"sync"
"github.com/tidwall/redcon"
"github.com/tidwall/redcon/v2"
)
var addr = ":6380"

View File

@ -1,11 +1,12 @@
package main
import (
"context"
"log"
"strings"
"sync"
"github.com/nathanhack/redcon"
"github.com/tidwall/redcon/v2"
)
var addr = ":6380"
@ -16,7 +17,7 @@ func main() {
var ps redcon.PubSub
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) {
switch strings.ToLower(string(cmd.Args[0])) {
default:

View File

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

View File

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

View File

@ -1,12 +1,13 @@
package main
import (
"context"
"crypto/tls"
"log"
"strings"
"sync"
"github.com/nathanhack/redcon"
"github.com/tidwall/redcon/v2"
)
const serverKey = `-----BEGIN EC PARAMETERS-----
@ -47,7 +48,7 @@ func main() {
var items = make(map[string][]byte)
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) {
switch strings.ToLower(string(cmd.Args[0])) {
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