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
- Host: GitHub
- URL: https://github.com/akkuman/websocket
- Owner: akkuman
- Created: 2021-02-05T08:18:39.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-06T03:32:12.000Z (over 5 years ago)
- Last Synced: 2024-06-20T07:59:35.875Z (about 2 years ago)
- Topics: golang, golang-package, websocket
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)
...
}
```