I'm making a webserver in go that act like a proxy. I need to get the infos about the client to give its response. Here is my code:
func main(){
li, err := net.Listen("tcp", ":8000")
if err != nil{
log.Fatalln(err.Error())
}
defer li.Close()
for{
conn, err := li.Accept()
if err != nil {
log.Fatalln(err.Error())
}
local := conn.LocalAddr
remote := conn.RemoteAddr
fmt.Println(string(local.Network))
fmt.Println(string(remote.String))
go handleConn(conn)
}
}
The problem is when i run i receive this message:
local.Network undefined (type func() net.Addr has no field or method Network)
but the documentation says the Addr type has this methods