Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/hazelcast/hazelcast-go-client
Hazelcast is an open-source distributed in-memory data store and computation platform that provides a wide variety of distributed data structures and concurrency primitives.
Hazelcast Go client is a way to communicate with Hazelcast 4 and 5 clusters and access the cluster data.
package main
import (
"context"
"fmt"
"log"
"github.com/hazelcast/hazelcast-go-client"
)
func main() {
ctx := context.TODO()
// create the client and connect to the cluster on localhost
client, err := hazelcast.StartNewClient(ctx)
if err != nil {
log.Fatal(err)
}
// get a map
people, err := client.GetMap(ctx, "people")
if err != nil {
log.Fatal(err)
}
personName := "Jane Doe"
// set a value in the map
if err = people.Set(ctx, personName, 30); err != nil {
log.Fatal(err)
}
// get a value from the map
age, err := people.Get(ctx, personName)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s is %d years old.\n", personName, age)
// stop the client to release resources
client.Shutdown(ctx)
}
Requirements:
In your Go module enabled project, add a dependency to github.com/hazelcast/hazelcast-go-client
:
# Depend on the latest release
$ go get github.com/hazelcast/hazelcast-go-client@latest
Hazelcast Go client requires a working Hazelcast cluster.
Check out our Get Started page for options.
Start the client with the default Hazelcast host and port using hazelcast.StartNewClient
, when Hazelcast is running on local with the default options:
ctx := context.TODO()
client, err := hazelcast.StartNewClient(ctx)
// handle client start error
Note that Config
structs are not thread-safe. Complete creation of the configuration in a single goroutine.
// create the default configuration
config := hazelcast.Config{}
// optionally set member addresses manually
config.Cluster.Network.SetAddresses("member1.example.com:5701", "member2.example.com:5701")
// create and start the client with the configuration provider
client, err := hazelcast.StartNewClientWithConfig(ctx, config)
// handle client start error
Hazelcast Go Client documentation is hosted at pkg.go.dev.
You can view the documentation locally by using godoc:
$ godoc -http=localhost:5500
godoc is not installed by default with the base Go distribution. Install it using:
$ go get -u golang.org/x/tools/...`
Join us at Go Client channel or Hazelcast at Google Groups.
Currently, we support only Linux, MacOS and WSL (Windows Subsystem for Linux) for testing the client.
You need to have the following installed in order to run integration tests:
Before running the tests, starts Hazelcast Remote Controller, which enables the test suite to create clusters:
# Start RC with Hazelcast Community features
$ ./rc.sh start
# Or, start RC with Hazelcast Enterprise features
$ HAZELCAST_ENTERPRISE_KEY=ENTERPRISE-KEY-HERE ./rc.sh start
You can run the tests using one of the following approaches:
make test-all
to run integration tests.make test-all-race
to run integration tests with race detection.make test-cover
to generate the coverage report and make view-cover
to view the test coverage summary and generate an HTML report.Testing the client with SSL support requires running the remote controller with Hazelcast Enterprise features.
To enable SSL connections, add ENABLE_SSL=1
to environment variables, or prepend it to the make commands above.
In order to turn on verbose logging, add ENABLE_TRACE=1
to environment variables, or prepend it to the make commands above.
Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.
Visit www.hazelcast.com for more information.
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.