Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d9a5b1160c |
6
node.go
6
node.go
@ -77,10 +77,11 @@ type FrameStats struct {
|
|||||||
func (node *Node) open(ctx context.Context) error {
|
func (node *Node) open(ctx context.Context) error {
|
||||||
header := http.Header{}
|
header := http.Header{}
|
||||||
|
|
||||||
header.Set("User-Agent", gavalinkUserAgent())
|
|
||||||
header.Set("Authorization", node.config.Password)
|
header.Set("Authorization", node.config.Password)
|
||||||
header.Set("Num-Shards", strconv.Itoa(node.manager.shards))
|
header.Set("Num-Shards", strconv.Itoa(node.manager.shards))
|
||||||
header.Set("User-Id", node.manager.userID)
|
header.Set("User-Id", node.manager.userID)
|
||||||
|
header.Set("Client-Name", "Gavalink")
|
||||||
|
header.Set("User-Agent", gavalinkUserAgent())
|
||||||
|
|
||||||
if node.manager.capabilities != nil {
|
if node.manager.capabilities != nil {
|
||||||
v := make([]string, 0)
|
v := make([]string, 0)
|
||||||
@ -104,8 +105,10 @@ func (node *Node) open(ctx context.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This isn't officially required, so we ignore it for now if it's empty.
|
||||||
vstr := resp.Header.Get("Lavalink-Major-Version")
|
vstr := resp.Header.Get("Lavalink-Major-Version")
|
||||||
|
|
||||||
|
if vstr != "" {
|
||||||
v, err := strconv.Atoi(vstr)
|
v, err := strconv.Atoi(vstr)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -115,6 +118,7 @@ func (node *Node) open(ctx context.Context) error {
|
|||||||
if v < 3 {
|
if v < 3 {
|
||||||
return errInvalidVersion
|
return errInvalidVersion
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
node.wsConn = ws
|
node.wsConn = ws
|
||||||
go node.listen()
|
go node.listen()
|
||||||
|
Loading…
Reference in New Issue
Block a user