
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
github.com/smallnest/resp3
The first redis RESP3 protocol library, written in Go.
You can use it to communicte with Redis 6 via RESP3, or you can wrap it as redis client lib.
Value
represents a redis command or an redis response, which supports all RESP3 types:
Reader
is used to read a Value
object from the connection. It can be used by both redis clients and redis servers.
you can use it to test the client cache feature in Redis 6.0.
func TestReader_IT_Tracking(t *testing.T) {
conn, err := net.DialTimeout("tcp", "127.0.0.1:6379", 5*time.Second)
if err != nil {
t.Logf("can't found one of redis 6.0 server")
return
}
defer conn.Close()
w := NewWriter(conn)
r := NewReader(conn)
w.WriteCommand("HELLO", "3")
helloResp, _, err := r.ReadValue()
if err != nil {
t.Fatalf("failed to send a HELLO 3")
}
if helloResp.KV.Size() == 0 {
t.Fatalf("expect some info but got %+v", helloResp)
}
t.Logf("hello response: %c, %v", helloResp.Type, helloResp.SmartResult())
w.WriteCommand("CLIENT", "TRACKING", "on")
resp, _, err := r.ReadValue()
if err != nil {
t.Fatalf("failed to TRACKING: %v", err)
}
t.Logf("TRACKING result: %c, %+v", resp.Type, resp.SmartResult())
w.WriteCommand("GET", "a")
resp, _, err = r.ReadValue()
if err != nil {
t.Fatalf("failed to GET: %v", err)
}
t.Logf("GET result: %c, %+v", resp.Type, resp.SmartResult())
go func() {
conn, err := net.DialTimeout("tcp", "127.0.0.1:9999", 5*time.Second)
if err != nil {
t.Logf("can't found one of redis 6.0 server")
return
}
defer conn.Close()
w := NewWriter(conn)
r := NewReader(conn)
for i := 0; i < 10; i++ {
//PUBLISH
w.WriteCommand("set", "a", strconv.Itoa(i))
resp, _, err = r.ReadValue()
if err != nil {
t.Fatalf("failed to set: %v", err)
}
t.Logf("set result: %c, %+v", resp.Type, resp.SmartResult())
time.Sleep(200 * time.Millisecond)
}
}()
for i := 0; i < 10; i++ {
resp, _, err = r.ReadValue()
if err != nil {
t.Fatalf("failed to receive a message: %v", err)
}
if resp.Type == TypePush && len(resp.Elems) >= 2 && resp.Elems[0].SmartResult().(string) == "invalidate" {
t.Logf("received TRACKING result: %c, %+v", resp.Type, resp.SmartResult())
// refresh cache "a"
w.WriteCommand("GET", "a")
resp, _, err = r.ReadValue()
}
}
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.