Apply goformat on source code

This commit is contained in:
wpetit 2018-09-18 18:01:28 +02:00
parent c4d6acdb9f
commit 67dd1d6bfb
6 changed files with 11 additions and 12 deletions

View File

@ -7,9 +7,9 @@ import (
)
const (
webSocketProtocol = "ws://"
webSocketProtocol = "ws://"
webSocketSecureProtocol = "wss://"
socketioUrl = "/socket.io/?EIO=3&transport=websocket"
socketioUrl = "/socket.io/?EIO=3&transport=websocket"
)
/**
@ -22,7 +22,7 @@ type Client struct {
/**
Get ws/wss url by host and port
*/
*/
func GetUrl(host string, port int, secure bool) string {
var prefix string
if secure {

View File

@ -137,7 +137,6 @@ func inLoop(c *Channel, m *methods) error {
go m.processIncomingMessage(c, msg)
}
}
return nil
}
var overflooded map[*Channel]struct{} = make(map[*Channel]struct{})
@ -178,7 +177,6 @@ func outLoop(c *Channel, m *methods) error {
return closeChannel(c, m, err)
}
}
return nil
}
/**

View File

@ -42,4 +42,3 @@ type Message struct {
Args string
Source string
}

View File

@ -15,8 +15,8 @@ const (
ackMessage = "43"
CloseMessage = "1"
PingMessage = "2"
PongMessage = "3"
PingMessage = "2"
PongMessage = "3"
)
var (

View File

@ -44,7 +44,7 @@ type Server struct {
/**
Close current channel
*/
*/
func (c *Channel) Close() {
if c.server != nil {
closeChannel(c, &c.server.methods)
@ -238,7 +238,7 @@ func (s *Server) BroadcastToAll(method string, args interface{}) {
Generate new id for socket.io connection
*/
func generateNewId(custom string) string {
hash := fmt.Sprintf("%s %s %n %n", custom, time.Now(), rand.Uint32(), rand.Uint32())
hash := fmt.Sprintf("%s %s %d %d", custom, time.Now(), rand.Uint32(), rand.Uint32())
buf := bytes.NewBuffer(nil)
sum := md5.Sum([]byte(hash))
encoder := base64.NewEncoder(base64.URLEncoding, buf)

View File

@ -2,14 +2,16 @@ package transport
import (
"errors"
"github.com/gorilla/websocket"
"io/ioutil"
"log"
"net/http"
"time"
"github.com/gorilla/websocket"
)
const (
upgradeFailed = "Upgrade failed: "
upgradeFailed = "Upgrade failed: "
WsDefaultPingInterval = 30 * time.Second
WsDefaultPingTimeout = 60 * time.Second