mirror of
https://github.com/raz-varren/sacrificial-socket.git
synced 2025-12-24 12:38:09 +08:00
just a fmt
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
package ssdummy
|
||||
|
||||
import (
|
||||
ss "github.com/raz-varren/sacrificial-socket"
|
||||
"github.com/raz-varren/log"
|
||||
ss "github.com/raz-varren/sacrificial-socket"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package ssgrpc
|
||||
|
||||
import (
|
||||
"github.com/raz-varren/sacrificial-socket/backend/ssgrpc/token"
|
||||
"github.com/raz-varren/log"
|
||||
"github.com/raz-varren/sacrificial-socket/backend/ssgrpc/token"
|
||||
"golang.org/x/net/context"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -3,10 +3,10 @@ package ssgrpc
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/raz-varren/log"
|
||||
ss "github.com/raz-varren/sacrificial-socket"
|
||||
"github.com/raz-varren/sacrificial-socket/backend/ssgrpc/token"
|
||||
"github.com/raz-varren/sacrificial-socket/backend/ssgrpc/transport"
|
||||
"github.com/raz-varren/log"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"strings"
|
||||
|
||||
@@ -5,9 +5,9 @@ package ssgrpc
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/raz-varren/log"
|
||||
ss "github.com/raz-varren/sacrificial-socket"
|
||||
"github.com/raz-varren/sacrificial-socket/backend/ssgrpc/transport"
|
||||
"github.com/raz-varren/log"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
|
||||
@@ -5,8 +5,8 @@ package ssmongo
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
ss "github.com/raz-varren/sacrificial-socket"
|
||||
"github.com/raz-varren/log"
|
||||
ss "github.com/raz-varren/sacrificial-socket"
|
||||
"gopkg.in/mgo.v2"
|
||||
"gopkg.in/mgo.v2/bson"
|
||||
"io"
|
||||
|
||||
@@ -4,13 +4,13 @@ Package ssredis provides a ss.MultihomeBackend interface that uses Redis for syn
|
||||
package ssredis
|
||||
|
||||
import (
|
||||
"github.com/go-redis/redis"
|
||||
ss "github.com/raz-varren/sacrificial-socket"
|
||||
"github.com/raz-varren/log"
|
||||
"encoding/hex"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/raz-varren/log"
|
||||
ss "github.com/raz-varren/sacrificial-socket"
|
||||
)
|
||||
|
||||
var(
|
||||
var (
|
||||
rng = ss.NewRNG()
|
||||
)
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ package main
|
||||
import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"github.com/raz-varren/log"
|
||||
"github.com/raz-varren/sacrificial-socket"
|
||||
"github.com/raz-varren/sacrificial-socket/backend/ssgrpc"
|
||||
"github.com/raz-varren/log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
@@ -7,9 +7,9 @@ import (
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/raz-varren/log"
|
||||
"github.com/raz-varren/sacrificial-socket"
|
||||
"github.com/raz-varren/sacrificial-socket/backend/ssredis"
|
||||
"github.com/raz-varren/log"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
@@ -5,8 +5,8 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
ss "github.com/raz-varren/sacrificial-socket"
|
||||
"github.com/raz-varren/log"
|
||||
ss "github.com/raz-varren/sacrificial-socket"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ func (serv *SocketServer) Shutdown() bool {
|
||||
}
|
||||
|
||||
//EventHandler is an interface for registering events using SockerServer.OnEvent
|
||||
type EventHandler interface{
|
||||
type EventHandler interface {
|
||||
HandleEvent(*Socket, []byte)
|
||||
EventName() string
|
||||
}
|
||||
@@ -111,9 +111,9 @@ func (serv *SocketServer) On(eventName string, handleFunc func(*Socket, []byte))
|
||||
serv.events[eventName] = &event{eventName, handleFunc} //you think you can handle the func?
|
||||
}
|
||||
|
||||
//OnEvent has the same functionality as On, but accepts
|
||||
//OnEvent has the same functionality as On, but accepts
|
||||
//an EventHandler interface instead of a handler function.
|
||||
func (serv *SocketServer) OnEvent(h EventHandler){
|
||||
func (serv *SocketServer) OnEvent(h EventHandler) {
|
||||
serv.On(h.EventName(), h.HandleEvent)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user