File tree Expand file tree Collapse file tree 1 file changed +0
-27
lines changed Expand file tree Collapse file tree 1 file changed +0
-27
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,8 @@ import (
21
21
"crypto/tls"
22
22
"fmt"
23
23
"io"
24
- "net"
25
24
"net/http"
26
25
"net/url"
27
- "os"
28
- "sort"
29
26
"strings"
30
27
)
31
28
@@ -136,29 +133,5 @@ func (s longestToShortest) Less(i, j int) bool {
136
133
// FQDN returns the fully-qualified domain name (or localhost if lookup
137
134
// according to the hostname fails).
138
135
func FQDN () (string , error ) {
139
- hostname , err := os .Hostname ()
140
- if err != nil {
141
- // Fail if the kernel fails to report a hostname.
142
- return "" , err
143
- }
144
-
145
- addrs , err := net .LookupHost (hostname )
146
- if err != nil {
147
- return "localhost" , nil
148
- }
149
-
150
- for _ , addr := range addrs {
151
- if names , err := net .LookupAddr (addr ); err == nil && len (names ) > 0 {
152
- sort .Sort (longestToShortest (names ))
153
- for _ , name := range names {
154
- name = strings .TrimRight (name , "." )
155
- if strings .HasPrefix (name , hostname ) {
156
- return name , nil
157
- }
158
- }
159
- return names [0 ], nil
160
- }
161
- }
162
-
163
136
return "localhost" , nil
164
137
}
You can’t perform that action at this time.
0 commit comments