2017-03-18 88 views
0

我一直在閱讀很多,但我找不到解決方案。Golang DNS解析不起作用

我在Google Cloud中打開了一個VPS,使用Ubuntu啓動了一個實例並運行了我在Go中編寫的Web服務器,在80端口監聽。我還在我的國家www.crosslogic.com.ar註冊了一個域,像這樣:

n1.crosslogic.com.ar 130.211.196.55 
n2.crosslogic.com.ar 130.211.196.55 

(都需要兩個,但我只有一個IP)

當我在瀏覽器中的一切一切工作正常鍵入IP,但是當我試圖訪問服務器使用www.crosslogic .com.ar或crosslogic.com.ar或n1.crosslogic.com.ar我收到ERR_NAME_RESOLUTION_FAILED。

我沒有這個測試intodns.com/crosslogic.com.ar檢查如下因素的錯誤:

-Missing nameservers reported by your nameservers. You should already know that your NS records at your nameservers are missing, so here it is again: 
ns2.crosslogic.com.ar. 
ns1.crosslogic.com.ar. 

-No valid SOA record came back! 

-ERROR: I could not get any A records for www.crosslogic.com.ar! 
(I only do a cache request, if you recently added a WWW A record, it might not show up here.) 

這是代碼:

package main 

import (
    "net/http" 
) 

func main() { 
    // Genero un html con los detalles del calculo. 


    http.HandleFunc("/", indexHandler) 
    err := http.ListenAndServe(":80", nil) 
    if err != nil { 
     fmt.Println(err.Error()) 
    } 

} 

func indexHandler(w http.ResponseWriter, r *http.Request) { 

    temp, err := template.ParseFiles("index.html") 
    if err != nil { 
     panic(err) 
    } 

    err = temp.Execute(w, nil) 
    if err != nil { 
     panic(err) 
    } 
} 

我缺少在Linux的任何配置?那些NS記錄,A記錄和SOA是我需要在我的服務器中配置的東西?不應該http/net處理這些東西?爲什麼請求沒有達到我的端口80?

回答

1

該問題與您的代碼無關。您的DNS未正確註冊。當運行nslookup我得到如下:

$ nslookup n1.crosslogic.com.ar 

DNS request timed out. 
    timeout was 2 seconds. 
DNS request timed out. 
    timeout was 2 seconds. 
DNS request timed out. 
    timeout was 2 seconds. 
DNS request timed out. 
    timeout was 2 seconds. 

$ nslookup n2.crosslogic.com.ar 

DNS request timed out. 
    timeout was 2 seconds. 
DNS request timed out. 
    timeout was 2 seconds. 
DNS request timed out. 
    timeout was 2 seconds. 
DNS request timed out. 
    timeout was 2 seconds. 
+0

當你說「你的DNS」你的意思是我必須安裝喜歡的事BIND在我的服務器或相關的域名註冊的問題? – Marcos