Skip to content

Commit

Permalink
Merge pull request #390 from openconfig/fix389
Browse files Browse the repository at this point in the history
handle network type unix in the custom dialer
  • Loading branch information
karimra authored Mar 5, 2024
2 parents 6bbfbb0 + a9f75a9 commit 1213473
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/api/target/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,15 @@ func (t *Target) createCustomDialer(addr string) func(context.Context, string) (
}
ctx, cancel := context.WithTimeout(ctx, t.Config.Timeout)
defer cancel()
return dialer.DialContext(ctx, "tcp", addr)

var networkType = "tcp"
if indx := strings.Index(addr, "://"); indx > 0 {
if addr[:indx] == "unix" {
networkType = "unix"
addr = addr[indx+3:]
}
}
return dialer.DialContext(ctx, networkType, addr)
}
}

Expand Down

0 comments on commit 1213473

Please sign in to comment.