GoLang gRPC client on raspberryPI (armv7l) fails to handshake TLS 1.3 - go

I have a gRPC client written in GoLang that I'm running on raspberryPI 4 (armv7l).
When I run the client on my MacBook it connects to the server and everything is fine.
When I run the same client on RaspberryPI 4, I get an error:
transport: authentication handshake failed: tls: server selected unadvertised ALPN protocol
Looking at the standard library, I checked that this check fails:
https://github.com/golang/go/blob/346b18ee9d15410ab08dd583787c64dbed0666d2/src/crypto/tls/handshake_client_tls13.go#L399
Function checkALPN is defined here: https://github.com/golang/go/blob/346b18ee9d15410ab08dd583787c64dbed0666d2/src/crypto/tls/handshake_client.go#L752
I printed clientProtos []string, serverProto string and it turns out that when code is run on MacBook, clientProtos contains h2 (which stands for HTTP2) and serverProto is h2 which is fine, they match and the connection gets established according to protocol.
When the same code is run on RaspberryPI, clientProtos is http/1.1 and server proto is h2 (gRPC connection can be established only over HTTP2) so there's a mismatch so the client fails to connect and says "server selected unadvertised ALPN protocol" which makes total sense. Any hints on how to proceed? Is there a reason why the client on RaspberryPI doesn't want to use HTTP2? Or maybe I have to set it somewhere? Or install something? Not sure how to proceed here and Google doesn't help. I also tried compiling client code with GoLang 1.16 but got the same error

Related

read tcp [addr]->[addr] use of closed network connection

I'm using Google's simplehttp2server go-lang program to run some tests and have encountered a recurring error. Upon executing the TLS handshake I receive the following error:
2019/12/12 12:42:55 http: TLS handshake error from 127.0.0.1:36202: read tcp 127.0.0.1:5000->127.0.0.1:36202: use of closed network connection
I have updated my go version to 1.13.5 from 1.12.9 and tried two browsers (brave + chrome) plus curl and receive the same error code each time. It happens over HTTP/2 and HTTP/1.1. I have seem other answers from across the web but am still running into this error (ex1, ex2, ex3, ex4).
Very much appreciate any feedback, advice, or admonishment. Anything to help the migraine this problem is giving me!
edit: screenshot from my curl and running of simplehttp2server
example image from curl and simplehttp2server
This error happens when you have two websockets connected to a singular address using the same port from the same machine. One of the websockets will be able to connect fine but the other wont be able to make the connection.
I was making the same mistake and when I removed the duplicate connection the error resolved.

Poloniex Push WAMP API through Autobahn dropping connection to peer tcp

I tried to connect to the Push API in poloniex using python and followed the instructions on the answer here:
How to connect to poloniex.com websocket api using a python library
However I keep getting this error:
2017-06-25T04:07:04 dropping connection to peer tcp:104.20.13.48:443 with abort=True: WebSocket opening handshake timeout (peer did not finish the opening handshake in time)
Anyone know what's going on here? I can't figure it out from online documentation. Thanks!
As per #Cyphrags suggestion, I was able to get my autobahn websocket to work outside of localhost by increasing openHandshakeTimeout with factory.setProtocolOptions
factory.protocol = MyClientProtocol
factory.setProtocolOptions(failByDrop=False, openHandshakeTimeout=90, closeHandshakeTimeout=5)
Solution found via https://github.com/crossbario/crossbar/issues/930. Perhaps the reason it is needed has something to do with slow DNS routing taking longer than the default handshake time.

Why is this websocket connection being refused?

I try to use the slack-sample bot from this blogpost https://www.opsdash.com/blog/slack-bot-in-golang.html . I've successfully created my api token, but i can not connect to the websocket server (the rtm.start request passs normally). I've get the error message
dial tcp 54.242.95.213:443: connectex: No connection could be made because the target machine actively refused it
I've also tried to connect via a chrome app called Simple Web Socket Client and via a website based one tester. Both work well, i can establish a connection and i can send data.
I'm behind a proxy, but i only have troubles with golang's websocket.Dial function.
Does anybody know why this can happen?
I use:
- Windows 7 SP1 x64
- Golang 1.7.1 windows/amd64
Greetings
Tonka
If you are using gorilla/websocket, it has the ability to use a Proxy. From issue 107:
import "net/http"
...
var dialer = websocket.Dialer{
Proxy: http.ProxyFromEnvironment,
}
If you are using golang.org/x/net you should switch to gorilla/websocket.

Websockify base64: 'False'

When I'm starting websockify with python2.7 on my server no warnings appear, everything is ok.
But when the first connection comes in there are problems with base64 I think:
1: <ip>: Plain non-SSL (ws://) WebSocket connection
1: <ip>: Version hybi-13, base64: 'False'
1: connecting to: <myserver.com>:64749
On the client side I get an error in safari but it also tells me that the connection is made and I'm able to send and receive messages:
WebSocket network error: The operation couldn’t be completed. Connection refused ws://localhost:17523
The error about connecting to ws://localhost:17523 is harmless. In order to test whether the WebSocket API supports binary data it is necessary to actually instantiate a WebSocket object, however, WebSocket objects must be instantiated with an actual destination so websock.js uses a localhost port to test the connection. The browser complains that the connection fails but websock.js is able to use that object to do its test.
The base64: False indicates that the client and server have negotiated to use raw binary data and don't need to use base64 encoded strings to encode the data. Base64 encoding is necessary in older browsers (or with web-socket-js emulator) that support WebSockets but not binary data.
Since you are successfully sending and receiving data, I assume this question is just verifying that the messages you are seeing aren't major problems correct?

how to connect http server implemented by the c# socket class

I have finished http protocol via the socket class according to rfc2616 protocol, but how to connect https protocol and send data to server using the socket class?
When i connected https server https://www.example.com, I always get 404 error. The following is the socket command that to send to server https://www.example.com/
GET / HTTP/1.1 Host: www.example.com
the default always use http protocol
I found connected to https server need to use a connect command instead of the Get command and a client certificate. for example:
CONNECT login.example.com:443 HTTP/1.0
Major Version: 3
Minor Version: 1
......
I will try to use the connect command. Thanks for your replies.
==================================================
OK,i have solved my problem ,use the SLStream class.
NetworkStream networkStream=new NetWorkStream(socket)
var stream=New SslStream(networkStream)
.......
Now, will can read stream and write stream, until finished.

Resources