pranoy k
pranoy k

Reputation: 55

How to get greetings from a DENIC registry connection?

I am trying to establish a connection and read the greetings by connecting to the test DENIC registry which is a RRI registry. But every time I only get a response EOF.

This is the go code I am running

func main() {
        log.Println("Attempting to connect...")
    conn, err := net.DialTimeout("tcp", "<host>:<port>", time.Second*15)
    if err != nil {
        log.Fatalln("Error connecting:", err)
    }
    log.Println("TCP connection established")

    tlsConfig := &tls.Config{
        ServerName:         "<host>",
        InsecureSkipVerify: true,
    }

    log.Println("Starting TLS handshake...")
    newConn := tls.Client(conn, tlsConfig)
    err = newConn.SetDeadline(time.Now().Add(time.Second * 30))
    if err != nil {
        log.Fatalln("Error setting deadline:", err)
    }

    err = newConn.Handshake()
    if err != nil {
        log.Fatalf("could not perform TLS handshake, err : %s", err.Error())
    }

    // Read the server's response
    buf := make([]byte, 4096)
    n, err := newConn.Read(buf)
    if err != nil {
        log.Printf("Failed to read: %v\n", err)
        return
    }

    // Print response from the server
    log.Printf("Server response: %s\n", string(buf[:n]))

}

I was expecting a greeting message as the last response containing EPP greeting attributes but instead see EOF response.

Also, I cannot use any DENIC registry specific library as I am dealing with multiple registries and cannot use specific libraries for each one of them.

Upvotes: 1

Views: 55

Answers (0)

Related Questions