Merge pull request #704 from dondish/develop

Fixed holdup issue in voice

Discord changed the IP used for VoiceConnection.  Change code to follow suit.
This commit is contained in:
bwmarrin 2019-10-18 08:51:08 -05:00 committed by GitHub
commit 0364b15ee4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

2
go.mod
View file

@ -4,3 +4,5 @@ require (
github.com/gorilla/websocket v1.4.0
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16
)
go 1.13

View file

@ -243,6 +243,7 @@ type voiceOP2 struct {
Port int `json:"port"`
Modes []string `json:"modes"`
HeartbeatInterval time.Duration `json:"heartbeat_interval"`
IP string `json:"ip"`
}
// WaitUntilConnected waits for the Voice Connection to
@ -542,7 +543,7 @@ func (v *VoiceConnection) udpOpen() (err error) {
return fmt.Errorf("empty endpoint")
}
host := strings.TrimSuffix(v.endpoint, ":80") + ":" + strconv.Itoa(v.op2.Port)
host := v.op2.IP + ":" + strconv.Itoa(v.op2.Port)
addr, err := net.ResolveUDPAddr("udp", host)
if err != nil {
v.log(LogWarning, "error resolving udp host %s, %s", host, err)