
Security News
Open VSX Begins Implementing Pre-Publish Security Checks After Repeated Supply Chain Incidents
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.
gRPC over HTTP and Websockets
NOTICE: The project is still in early stages of development, and not all gRPC functionality has been verified to work. Use at your own risk and contribute back if you find something that is missing.
gRPC is an amazing framework. But sometimes it is impossible to use due to the underlying transport layer. This project allows to use your already existing codebase, and add interceptors and a proxy to make your gRPC work over normal HTTP and Websockets - no generation necessary!
This example shows how to add go-plain-grpc to helloworld example from gRPC-go repository.
package main
import (
"net/url"
"google.golang.org/grpc"
"voy.technology/plain-grpc"
pb "google.golang.org/grpc/examples/helloworld/helloworld"
)
var endpointFlag = flag.String("endpoint", "", "Endpoint to the serve")
func main() {
flag.Parse()
// Error parsing removed for brevity
endpoint, _ := url.Parse(*endpointFlag)
opts := []grpc.DialOption{
grpc.WithInsecure(),
}
// gRPC doesn't like Scheme in front of the connection url. We can use it to
// our advantage to select when we want to use go-plain-grpc.
if endpoint.Scheme == "http" {
i := plaingrpc.NewHijacker(endpoint.String())
opts = append(opts,
grpc.WithUnaryInterceptor(i.UnaryInterceptor),
grpc.WithStreamInterceptor(i.StreamInterceptor))
}
conn, _ := grpc.Dial(entrypoint.String(), opts...)
defer conn.Close()
c := pb.NewGreeterClient(conn)
// Proceed as normal
}
package main
// These can be combined into a single service using cmux
var httpPortFlag = flag.Int("http-port", 8080, "HTTP port")
var grpcPortFlag = flag.Int("grpc-port", 8888, "gRPC port")
func main() {
flag.Parse()
lis, _ := net.Listen("tcp", fmt.Sprintf(":%d", *grpcPortFlag))
s := grpc.NewServer()
pb.RegisterGreeterServer(s, &server{})
go s.Serve(lis)
// Proxy forwards all requests from HTTP server to the gRPC server
proxy, _ := plaingrpc.NewProxy(s, lis.Addr())
// Register the endpoints
http.Handle("/", proxy)
http.ListenAndServe(fmt.Sprintf(":%d", *httpPortFlag), nil)
}
Special Thanks to Mike Cheng for grpc-over-http on which this project is roughly based on.
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
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.

Research
/Security News
Threat actors compromised four oorzc Open VSX extensions with more than 22,000 downloads, pushing malicious versions that install a staged loader, evade Russian-locale systems, pull C2 from Solana memos, and steal macOS credentials and wallets.

Security News
Lodash 4.17.23 marks a security reset, with maintainers rebuilding governance and infrastructure to support long-term, sustainable maintenance.