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

@ -22,7 +22,7 @@ type Client struct {
/** /**
Get ws/wss url by host and port Get ws/wss url by host and port
*/ */
func GetUrl(host string, port int, secure bool) string { func GetUrl(host string, port int, secure bool) string {
var prefix string var prefix string
if secure { if secure {

View File

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

View File

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

View File

@ -44,7 +44,7 @@ type Server struct {
/** /**
Close current channel Close current channel
*/ */
func (c *Channel) Close() { func (c *Channel) Close() {
if c.server != nil { if c.server != nil {
closeChannel(c, &c.server.methods) closeChannel(c, &c.server.methods)
@ -238,7 +238,7 @@ func (s *Server) BroadcastToAll(method string, args interface{}) {
Generate new id for socket.io connection Generate new id for socket.io connection
*/ */
func generateNewId(custom string) string { 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) buf := bytes.NewBuffer(nil)
sum := md5.Sum([]byte(hash)) sum := md5.Sum([]byte(hash))
encoder := base64.NewEncoder(base64.URLEncoding, buf) encoder := base64.NewEncoder(base64.URLEncoding, buf)

View File

@ -2,10 +2,12 @@ package transport
import ( import (
"errors" "errors"
"github.com/gorilla/websocket"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"time" "time"
"github.com/gorilla/websocket"
) )
const ( const (