An open API service indexing awesome lists of open source software.

https://github.com/akkuman/websocket

websocket is copy of golang.org/x/net/websocket, can set Host and TlsConfig
https://github.com/akkuman/websocket

golang golang-package websocket

Last synced: 5 months ago
JSON representation

websocket is copy of golang.org/x/net/websocket, can set Host and TlsConfig

Awesome Lists containing this project

README

          

# websocket

websocket is copy of [golang.org/x/net/websocket](golang.org/x/net/websocket)

## Feature

1. Set Host Header when websocket handshark

You can send handshark data to special address with different Host header

2. Set TLS Config

You can set InsecureSkipVerify to ignore ssl verify error

3. Fully compatible

You can replace `golang.org/x/net/websocket` package with `github.com/akkuman/websocket`

## Example

```golang
// set host and tls config

package main

import (
"fmt"
"log"

"golang.org/x/net/websocket"
)

func main() {
origin := "http://localhost/"
url := "ws://localhost:12345/ws"
ws := websocket.NewConfig(url, origin, websocket.WithSourceHost("baidu.com"), websocket.WithTLSConfig(&tls.Config{
InsecureSkipVerify: true,
}))

conn, err := websocket.DialConfig(cfg)

...
}
```