[Nfd-dev] YaNFD cannot create TCP face
XINYU MA
ma.xinyu.26a at kyoto-u.jp
Thu Sep 22 01:22:25 PDT 2022
Hello,
Thank you for reporting this bug.
It should be fixed by
https://github.com/named-data/YaNFD/commit/f7767468f3d4540e468bc0bd5a195066eb2a20d4
Best wishes,
Xinyu Ma.
2022年9月21日(水) 3:00 郝广宇 <haoguangyu at chorustek.com>:
> I have a YaNFD issue of that failed with "nfdc face create remote
> tcp4://X.X.X.X:6363", I read the source code that not tcp supported, the
> following is the code.
> No case of tcpURI?
>
> // Canonize attempts to canonize the URI, if not already canonical.
> func (u *URI) Canonize() error {
> switch u.uriType {
> case devURI, fdURI:
> // Nothing to do to canonize these
> case ethernetURI:
> mac, err := net.ParseMAC(strings.Trim(u.path, "[]"))
> if err != nil {
> return core.ErrNotCanonical
> }
> u.scheme = "ether"
> u.path = mac.String()
> u.port = 0
> case udpURI:
> path := u.path
> zone := ""
> if strings.Contains(u.path, "%") {
> // Has zone, so separate out
> path = u.PathHost()
> zone = "%" + u.PathZone()
> }
> ip := net.ParseIP(strings.Trim(path, "[]"))
> if ip == nil {
> // Resolve DNS
> resolvedIPs, err := net.LookupHost(path)
> if err != nil || len(resolvedIPs) == 0 {
> return core.ErrNotCanonical
> }
> ip = net.ParseIP(resolvedIPs[0])
> if ip == nil {
> return core.ErrNotCanonical
> }
> }
>
> if ip.To4() != nil {
> u.scheme = "udp4"
> u.path = ip.String() + zone
> } else if ip.To16() != nil {
> u.scheme = "udp6"
> u.path = ip.String() + zone
> } else {
> return core.ErrNotCanonical
> }
> case unixURI:
> u.scheme = "unix"
> testPath := "/" + u.path
> if runtime.GOOS == "windows" {
> testPath = u.path
> }
> fileInfo, err := os.Stat(testPath)
> if err != nil && !os.IsNotExist(err) {
> // File couldn't be opened, but not just because it doesn't exist
> return core.ErrNotCanonical
> } else if err == nil && fileInfo.IsDir() {
> // File is a directory
> return core.ErrNotCanonical
> }
> u.port = 0
> default:
> return core.ErrNotCanonical
> }
>
> return nil
> }
> _______________________________________________
> Nfd-dev mailing list
> Nfd-dev at lists.cs.ucla.edu
> https://www.lists.cs.ucla.edu/mailman/listinfo/nfd-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/attachments/20220922/495e18b7/attachment.html>
More information about the Nfd-dev
mailing list