I am grateful for your help. 
After print the RemoteAddr, I figure out the RemoteAddr of domain socket is 
"@" not complete empty. Have you the same result?

Nathan Kerr於 2017年1月11日星期三 UTC+8上午12時32分13秒寫道:
>
> Hi,
>
> You can use RemoteAddr from *http.Request to tell the difference. When the 
> request comes through the unix socket, RemoteAddr is "" (i.e., blank).
>
> The source for my test server is at https://play.golang.org/p/m3h_L_ACks
>
> I used curl 127.0.0.1:3001 to test the tcp socket and curl-unix-socket 
> unix://`pwd`/tmp_socket: from https://github.com/Soulou/curl-unix-socket to 
> test the unix socket.
>
> Hopefully my server is similar to what you had. If not, please post some 
> code.
>
> Cheers,
>
> Nathan
>
> On Tuesday, January 10, 2017 at 3:23:30 PM UTC+1, hawk hsieh wrote:
>>
>> I open a port 80 and a unix socket to listen http request simultaneously.
>> I would like to determine where is the request coming from so that the 
>> request from unix socket is no need to be authorized.
>> Maybe the first problem is to know the listener from  http.ResponseWriter 
>> or *http.Request. I guess.
>> Is there any workaround or idiomatic manner to find the listener ? Any 
>> idea?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to