mirror of https://github.com/tidwall/redcon.git
prepare for PR
This commit is contained in:
parent
ea500d3d6b
commit
250feb7729
|
@ -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"
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/nathanhack/redcon"
|
||||
"github.com/tidwall/redcon/v2"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue