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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to