nknorg / tuna

A free market to use service by paying NKN or host service to earn NKN

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help needed

zhtangsh opened this issue · comments

hi there,

I'm seeking helps for the problems while trying tuna on my local machine.
I build and setup server and client with following message
Server

root@kitten:~/tuna/server# ./server
2019/04/04 09:00:43 Subscribed to topic httpproxy successfully: b317b7f7c40782a6aef13cf79e503e6e0d3859d016dcc26c17cf5bcb0ed59da2
2019/04/04 09:00:43 Subscribed to topic moonlight successfully: 0d7f6af8a0cdbe28c4ebce982f74e641a786a95e79b62ed2e9845b6dec56675b

Client

root@kitten:~/tuna/client# ./client
2019/04/04 09:01:18 Couldn't unmarshal metadata: invalid character '.' after top-level value
2019/04/04 09:01:18 Connected to TCP at 172.104.82.159:30004 from httpproxy.023ae19733cfe37fef9c5017bb8961f63cd0347fb0caa9da1eac8b121e1e38d89b
2019/04/04 09:01:18 Connected to TCP at 172.104.82.159:30004 from moonlight.023ae19733cfe37fef9c5017bb8961f63cd0347fb0caa9da1eac8b121e1e38d89b
2019/04/04 09:01:18 Connected to UDP at {172.104.82.159 30005 } from moonlight.023ae19733cfe37fef9c5017bb8961f63cd0347fb0caa9da1eac8b121e1e38d89b

Then I setup httpproxy on port 8888 on my browser and received this error on client.

2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:03:33 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files

Any suggestions on making it work?

You can try to switch to last version (Mar 11).

That's probably because of a change I pushed 1 hour ago. It contains incompatible changes to metadata format, so old metadata couldn't be parsed.

Thanks guys, I'll give it a try on commit 6611b90

Same error on dcb1297.

2019/04/04 09:12:11 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:12:11 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:12:11 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files
2019/04/04 09:12:11 Couldn't accept connection: accept tcp [::]:8888: accept4: too many open files

This is your computer's problem. Try to run ulimit -n 1024 in the same terminal window before running

Thanks man, errors are gone but I http proxy seems not working.
Assume client is on 172.104.82.159:8888 , I used following test.

export http_proxy='http://172.104.82.159:8888'
curl www.google.com
curl: (56) Recv failure: Connection reset by peer

Should following code work?

You should use 127.0.0.1:8888 on the same machine as client is running.
Also you shouldn't run server on the same machine as the public ip address will not be resolved. Since there are some server side running, you just need to use tuna client at the moment

got it. thanks man

  1. I start a server on remote vps with ./server
  2. I start client on local machine with ./client
  3. I run script export http_proxy='http://127.0.0.1:8888'&&curl www.google.com on local machine
    Now I got empty reply and this error on server.
 Couldn't connect to host 127.0.0.1:8888 with error: dial tcp 127.0.0.1:8888: connect: connection refused

I must miss some key points atm

never mind, it accidentally worked.

It's not working again..

Let's do it one at a time. What about you don't run the tuna server side, but just tuna client side?

It worked. I could see that my client connected to a remote server at
157.230.136.253:30004

Yes, that's the tuna server I'm running

If there are multiple tuna server, currently a random one will be selected. So your tuna server side may not be working properly. Did you open port 30004 and 30005 on it?

Oh I think I know. In order to provide proxy service, your tuna server side has to run a proxy software.

Yes, port 30004 and 30005 opened

tuna is just a tunnel, and the service needs to run separately.

alright, and is that what moonlight for?

Any suggestions on the proxy software?

I use this one for proxy: https://github.com/elazarl/goproxy
Moonlight is this one: https://moonlight-stream.org

Thanks a lot.