Need help with this RDAP git repo

I’m learning this RDAP repo https://github.com/openrdap/rdap. I know it starts with main.go under cmd/rdap, then the cli.go for RunCLI function. but for this size of project written in golang, can I get some help regarding how/where to decompose and decipher this go codes and structure? it’s a bit overwhleming for me.

Thanks
James

2 Likes

Do you have an objective (e.g. bug hunting) when you trace the codes? If not, it will be demotivating and overwhelming. :slight_smile:

When dealing with large size repository, you must go in with an objective (e.g. adding feature X, tracking a bug, extracting an algorithm etc.). If it has documentations, you might need to read it especially the “architecture” section to avoid getting lost in the code jungles.


You can also contact the project developers and raise an “issue” ticket to ask them question (TIP: make sure you clarify you’re new, you’re interested to use the software). Developers love to help you out as all of us are passionate about our users.

Otherwise, you’re gambling with time to wait for another person-with-interest to read the codes with you.

1 Like

I’m trying to follow the instruction showed in client.go advanced usage line 45 -70 and do a domain query (google.com as example) with this server https://rdap.markmonitor.com/rdap. following is my code, but get No RDAP servers responded successfully (tried 1 server(s)) error. this does work on their command line interface like rdap -s https://rdap.markmonitor.com/rdap google.com, and now I want to use code to implement this and get error. any idea?

package main

import (
	_ "context"
	"fmt"
	"github.com/openrdap/rdap"
	"github.com/openrdap/rdap/bootstrap"
	"net/url"
	"time"
)

func main() {
	// Advanced usage:
	//
	// This demonstrates custom FetchRoles, a custom Context, a custom HTTP client,
	// a custom Bootstrapper, and a custom timeout.
	//   // Nameserver query on rdap.nic.cz.
	server, _ := url.Parse("https://rdap.markmonitor.com/rdap")
	  req := &rdap.Request{
	    Type: rdap.DomainRequest,
	    Query: "google.com",
	    FetchRoles: []string{"all"},
	    Timeout: time.Second * 45, // Custom timeout.

	    Server: server,
	  }

	  //req = req.WithContext(context.Context) // Custom context (see https://blog.golang.org/context).

	  client := &rdap.Client{}
	  //client.HTTP = &http.Client{} // Custom HTTP client.
	  //client.Bootstrap = &bootstrap.Client{} // Custom bootstapper.

	  resp, err := client.Do(req)
	  if err != nil {
	  	fmt.Println(err.Error())
	  }

	  if ns, ok := resp.Object.(*rdap.Domain); ok {
	    fmt.Printf("Handle=%s Domain=%s\n", ns.Handle, ns.LDHName)
	  }
}
2 Likes

Post this to new issue. I’ll reply from there.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.