Limit session-based JSON RPC service to IPv4.

Client not ready for IPv6.
This commit is contained in:
Jonathan Moody 2022-11-22 13:27:40 -06:00
parent 90b641c86c
commit 22a50ad085

View file

@ -54,13 +54,13 @@ func (cr *gorillaRpcCodecRequest) Method() (string, error) {
func (s *Server) StartJsonRPC() error { func (s *Server) StartJsonRPC() error {
// Set up the pure JSONRPC server with persistent connections/sessions. // Set up the pure JSONRPC server with persistent connections/sessions.
if s.Args.JSONRPCPort != 0 { if s.Args.JSONRPCPort != 0 {
port := ":" + strconv.FormatUint(uint64(s.Args.JSONRPCPort), 10) port := ":" + strconv.Itoa(s.Args.JSONRPCPort)
laddr, err := net.ResolveTCPAddr("tcp", port) laddr, err := net.ResolveTCPAddr("tcp4", port)
if err != nil { if err != nil {
log.Errorf("ResoveIPAddr: %v\n", err) log.Errorf("ResoveIPAddr: %v\n", err)
goto fail1 goto fail1
} }
listener, err := net.ListenTCP("tcp", laddr) listener, err := net.ListenTCP("tcp4", laddr)
if err != nil { if err != nil {
log.Errorf("ListenTCP: %v\n", err) log.Errorf("ListenTCP: %v\n", err)
goto fail1 goto fail1