Documentation ¶
Index ¶
- Constants
- Variables
- func AsBool(b interface{}, def ...bool) bool
- func AsInt(num interface{}, def ...int) int
- func AsString(str interface{}, def ...string) string
- func Concat(str ...string) string
- func Cost(start_time time.Time) int
- func Crc32(str string) int
- func Date(times ...int) string
- func DateTime(times ...int) string
- func GetCookie(r *http.Request, key string) string
- func GetIp(r *http.Request) string
- func GetLocalIp() string
- func GetMapNode(m interface{}, keys ...string) (value interface{}, find bool)
- func InArray(search interface{}, arr interface{}, stricts ...bool) bool
- func Interceptor(guard bool, errmsg *Error, fmts ...interface{})
- func Ip2long(ipstr string) (ip int)
- func Join(strs interface{}, seps ...string) string
- func JsonDecode(data string) interface{}
- func JsonEncode(data interface{}) string
- func Long2ip(ip int) string
- func MD5(str string) string
- func MkTime(t ...int) int
- func Now() int
- func Rand(size int, kind int) []byte
- func RandStr(size int, kind ...int) string
- func SetCookie(rw http.ResponseWriter, key, val string, lifetime int, options ...interface{})
- func Sha1(str string) string
- func StrToTime(datetime string) int
- func ToFloat(num string, size ...int) float64
- func ToInt(num string) int
- func ToIntArray(nums []string) []int
- func ToString(num int) string
- func ToStringArray(nums []int) []string
- func VersionCompare(ver, oldver string) bool
- type CliServer
- type Config
- func (this *Config) Get(keys ...string) string
- func (this *Config) GetAll(section string) map[string]string
- func (this *Config) GetBool(keys ...string) bool
- func (this *Config) GetInt(keys ...string) int
- func (this *Config) GetInt64(keys ...string) int64
- func (this *Config) GetJson(keys ...string) interface{}
- func (this *Config) GetJsonBool(keys ...string) bool
- func (this *Config) GetJsonInt(keys ...string) int
- func (this *Config) GetJsonMap(keys ...string) map[string]string
- func (this *Config) GetJsonMapInt(keys ...string) map[string]int
- func (this *Config) GetJsonSlice(keys ...string) []string
- func (this *Config) GetJsonSliceInt(keys ...string) []int
- func (this *Config) GetJsonSliceMap(keys ...string) []map[string]string
- func (this *Config) GetJsonString(keys ...string) string
- func (this *Config) GetSlice(keys ...string) []string
- func (this *Config) GetSliceInt(keys ...string) []int
- func (this *Config) Init(configFile string) error
- func (this *Config) Load(configFile string) error
- type Error
- type Errorf
- type Executor
- type FileLogger
- func (this *FileLogger) Access(v ...interface{})
- func (this *FileLogger) Debug(v ...interface{})
- func (this *FileLogger) Error(v ...interface{})
- func (this *FileLogger) Info(v ...interface{})
- func (this *FileLogger) Init(logpath, logname string, loglevel int)
- func (this *FileLogger) Other(logname string, v ...interface{})
- func (this *FileLogger) Warn(v ...interface{})
- type HttpClient
- func (this *HttpClient) Get(requrl string, headers ...http.Header) (*httpResponse, error)
- func (this *HttpClient) Post(requrl string, post_data interface{}, headers ...http.Header) (*httpResponse, error)
- func (this *HttpClient) Request(method, requrl string, post_data interface{}, headers ...http.Header) (*httpResponse, error)
- type HttpServer
- type MAP
- type MysqlClient
- func (this *MysqlClient) Begin(is_readonly bool) *MysqlClient
- func (this *MysqlClient) Commit()
- func (this *MysqlClient) Execute(_sql string, val ...interface{}) int
- func (this *MysqlClient) FuncParam(param interface{}) string
- func (this *MysqlClient) GetAll(_sql string, val ...interface{}) []map[string]interface{}
- func (this *MysqlClient) GetOne(_sql string, val ...interface{}) interface{}
- func (this *MysqlClient) GetRow(_sql string, val ...interface{}) map[string]interface{}
- func (this *MysqlClient) Init()
- func (this *MysqlClient) Insert(table string, vals map[string]interface{}) int
- func (this *MysqlClient) Replace(table string, vals map[string]interface{}) int
- func (this *MysqlClient) Rollback()
- func (this *MysqlClient) SetDebug(open bool)
- func (this *MysqlClient) Update(table string, vals map[string]interface{}, where string, val ...interface{}) int
- type MysqlExplain
- type MysqlProxy
- type RedisClient
- func (this *RedisClient) Blpop(key string, timeout int) (val []string, err error)
- func (this *RedisClient) Brpop(key string, timeout int) (val []string, err error)
- func (this *RedisClient) Call(cmd string, args ...interface{}) (resp *redis.Resp, err error)
- func (this *RedisClient) Decr(key string) (val int, err error)
- func (this *RedisClient) Decrby(key string, increment int) (val int, err error)
- func (this *RedisClient) Del(key string) (err error)
- func (this *RedisClient) DelAll(keys []string) (err error)
- func (this *RedisClient) Exists(key string) (bool, error)
- func (this *RedisClient) Expire(key string, expire int) error
- func (this *RedisClient) ExpireAt(key string, timestamp int)
- func (this *RedisClient) Get(key string) (val string, err error)
- func (this *RedisClient) Hdel(key, field interface{}) error
- func (this *RedisClient) HdelAll(key string)
- func (this *RedisClient) Hexists(key string) (bool, error)
- func (this *RedisClient) Hget(key string, field interface{}) (val string, err error)
- func (this *RedisClient) HgetAll(key string) (val map[string]string, err error)
- func (this *RedisClient) Hincrby(key string, field interface{}, increment int) (val int, err error)
- func (this *RedisClient) HincrbyFloat(key string, field interface{}, increment interface{}) (val float64, err error)
- func (this *RedisClient) Hkeys(key string) (val []string, err error)
- func (this *RedisClient) Hmget(key string, fields interface{}) (val []string, err error)
- func (this *RedisClient) Hmset(key string, val interface{}) (err error)
- func (this *RedisClient) Hscan(key string, cursor, pattern, count interface{}) (val []string, err error)
- func (this *RedisClient) Hset(key string, field interface{}, val interface{}) error
- func (this *RedisClient) Hsetnx(key string, field interface{}, val interface{}) (err error)
- func (this *RedisClient) Incr(key string) (val int, err error)
- func (this *RedisClient) Incrby(key string, increment int) (val int, err error)
- func (this *RedisClient) IncrbyFloat(key string, increment interface{}) (val float64, err error)
- func (this *RedisClient) Init() error
- func (this *RedisClient) Keys(key string) (val []string, err error)
- func (this *RedisClient) Llen(key string) (val int, err error)
- func (this *RedisClient) Lpop(key string) (val string, err error)
- func (this *RedisClient) Lpush(key string, val interface{}) error
- func (this *RedisClient) Lrange(key string, start, stop int) (val []string, err error)
- func (this *RedisClient) Mget(keys []string) (val []string, err error)
- func (this *RedisClient) Rpop(key string) (val string, err error)
- func (this *RedisClient) Rpush(key string, val interface{}) error
- func (this *RedisClient) Sadd(key string, val interface{}) error
- func (this *RedisClient) Scan(cursor, pattern, count string) (val []string, err error)
- func (this *RedisClient) Scard(key string) (val int, err error)
- func (this *RedisClient) Set(key string, val interface{}) error
- func (this *RedisClient) Setex(key string, secs int, val interface{}) error
- func (this *RedisClient) SisMember(key string, member interface{}) (bool, error)
- func (this *RedisClient) Smembers(key string) (val []string, err error)
- func (this *RedisClient) Spop(key, count int) (val []string, err error)
- func (this *RedisClient) SrandMember(key, count int) (val []string, err error)
- func (this *RedisClient) Srem(key string, member interface{}) (val int, err error)
- func (this *RedisClient) Sscan(key string, cursor, pattern, count interface{}) (val []string, err error)
- func (this *RedisClient) Ttl(key string) (int, error)
- func (this *RedisClient) Zadd(key string, score int, val interface{}) error
- func (this *RedisClient) Zcard(key string) (val int, err error)
- func (this *RedisClient) Zincrby(key string, increment int, val interface{}) error
- func (this *RedisClient) Zrange(key string, start, stop int, withscores bool) (val []string, err error)
- func (this *RedisClient) ZrangeByScore(key string, min, max, start, step int, withscores bool) (val []string, err error)
- func (this *RedisClient) ZrangeBytes(key string, start, stop int, withscores bool) (val [][]byte, err error)
- func (this *RedisClient) Zrank(key string, member interface{}) (val int, err error)
- func (this *RedisClient) Zrem(key string, member interface{}) (val int, err error)
- func (this *RedisClient) ZremrangeByScore(key string, min, max int) (err error)
- func (this *RedisClient) Zrevrange(key string, start, stop int, withscores bool) (val []string, err error)
- func (this *RedisClient) ZrevrangeByScore(key string, start, step int, withscores bool) (val []string, err error)
- func (this *RedisClient) ZrevrangeBytes(key string, start, stop int, withscores bool) (val [][]byte, err error)
- func (this *RedisClient) Zrevrank(key string, member interface{}) (val int, err error)
- func (this *RedisClient) Zscore(key string, member interface{}) (val int, err error)
- type RedisProxy
- type Restrict
- func (this *Restrict) Add(uniqid string) bool
- func (this *Restrict) AddBlacklist(uniqid []string)
- func (this *Restrict) AddWhitelist(uniqid []string)
- func (this *Restrict) Check(uniqid string, update bool) bool
- func (this *Restrict) Delete(uniqid string)
- func (this *Restrict) Surplus(uniqid string) int
- func (this *Restrict) UseRedis(conf_name string)
- type RpcServer
Constants ¶
const ( DEFAULT_TTL = 5 * time.Minute CLEAN_INTERVAL = 30 * time.Minute )
const ( LevelNone = 0x00 LevelError = 0x01 LevelWarn = 0x02 LevelAccess = 0x04 LevelInfo = 0x08 LevelDebug = 0x10 LevelAll = 0xFF )
Log levels
const ( CACHE_TYPE_LOCAL = iota CACHE_TYPE_REDIS )
const ( RAND_KIND_NUM = 0 // 纯数字 RAND_KIND_LOWER = 1 // 小写字母 RAND_KIND_UPPER = 2 // 大写字母 RAND_KIND_ALL = 3 // 数字、大小写字母 )
const ACTION_SUFFIX = "Action"
controller中以此后缀结尾的方法会参与路由
const DEFAULT_ACTION = "Index"
const DEFAULT_CONTROLLER = "Index"
默认controller/action
Variables ¶
var ( //多语言时指定默认语言 DEFAULT_LANG = "CN" //成功 ERR_SUC = &Error{0, "OK"} //系统错误码 ERR_SYSTEM = &Error{10, "系统错误"} ERR_METHOD_INVALID = &Error{11, "请求不合法: %+v"} ERR_FREQ = &Error{12, "接口访问过于频繁: %+v"} ERR_RPCAUTH = &Error{13, "rpc认证失败:%+v"} ERR_OTHER = &Error{14, "%+v"} )
var Conf = &Config{}
var LocalCache = &localCache{}
var Logger = &FileLogger{}
var Mysql = &MysqlProxy{c: map[string]*MysqlClient{}}
var Redis = &RedisProxy{c: map[string]*RedisClient{}}
var TIME_ZONE = "Local" // Asia/Shanghai, UTC
在项目代码中指定时区
Functions ¶
func GetMapNode ¶
获取MAP的某个节点
func Interceptor ¶
捕获异常时,可同时返回data(通过fmts参数最后一个类型为map的值)
func JsonDecode ¶
func JsonDecode(data string) interface{}
func JsonEncode ¶
func JsonEncode(data interface{}) string
Types ¶
type CliServer ¶
type CliServer struct {
// contains filtered or unexported fields
}
func NewCliServer ¶
func NewCliServer() *CliServer
func (*CliServer) AddController ¶
func (this *CliServer) AddController(c interface{})
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) GetJsonBool ¶
func (*Config) GetJsonInt ¶
func (*Config) GetJsonSlice ¶
func (*Config) GetJsonSliceInt ¶
func (*Config) GetJsonSliceMap ¶
func (*Config) GetJsonString ¶
func (*Config) GetSliceInt ¶
type Errorf ¶
type Errorf struct { Code int Msg interface{} // contains filtered or unexported fields }
格式化输出错误信息 用于 Interceptor 拦截抛错 国际化产品,多语言时,Msg 可以设置为map[string]string ,如:{"CN":"系统错误", "EN":"system error"}
func (*Errorf) GetMessage ¶
type FileLogger ¶
type FileLogger struct {
// contains filtered or unexported fields
}
func NewLogger ¶
func NewLogger(logpath, name string, level int) *FileLogger
func (*FileLogger) Access ¶
func (this *FileLogger) Access(v ...interface{})
func (*FileLogger) Debug ¶
func (this *FileLogger) Debug(v ...interface{})
func (*FileLogger) Error ¶
func (this *FileLogger) Error(v ...interface{})
func (*FileLogger) Info ¶
func (this *FileLogger) Info(v ...interface{})
func (*FileLogger) Init ¶
func (this *FileLogger) Init(logpath, logname string, loglevel int)
func (*FileLogger) Other ¶
func (this *FileLogger) Other(logname string, v ...interface{})
func (*FileLogger) Warn ¶
func (this *FileLogger) Warn(v ...interface{})
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶
func NewHttpClient(timeouts ...int) *HttpClient
func (*HttpClient) Get ¶
func (this *HttpClient) Get(requrl string, headers ...http.Header) (*httpResponse, error)
type HttpServer ¶
type HttpServer struct { HttpAddr string HttpPort int Timeout int // contains filtered or unexported fields }
http服务监听,路由
func NewHttpServer ¶
func NewHttpServer(addr string, port int, timout int, pprof bool) *HttpServer
func (*HttpServer) AddController ¶
func (this *HttpServer) AddController(c interface{}, group ...string)
func (*HttpServer) Run ¶
func (this *HttpServer) Run()
func (this *HttpServer) Run() { runtime.GOMAXPROCS(runtime.NumCPU()) addr := fmt.Sprintf("%s:%d", this.HttpAddr, this.HttpPort) s := &http.Server{ Addr: addr, Handler: this.handler, ReadTimeout: time.Duration(this.Timeout) * time.Millisecond, WriteTimeout: time.Duration(this.Timeout) * time.Millisecond, } log.Println("HttpServer Listen: ", addr) log.Println(s.ListenAndServe()) }
run with endless
type MysqlClient ¶
type MysqlClient struct { ID string Host string User string Password string Database string Charset string MaxOpenConns int MaxIdleConns int Debug bool // contains filtered or unexported fields }
func (*MysqlClient) Begin ¶
func (this *MysqlClient) Begin(is_readonly bool) *MysqlClient
func (*MysqlClient) Commit ¶
func (this *MysqlClient) Commit()
func (*MysqlClient) Execute ¶
func (this *MysqlClient) Execute(_sql string, val ...interface{}) int
Execute {{{
func (*MysqlClient) FuncParam ¶
func (this *MysqlClient) FuncParam(param interface{}) string
拼装参数时,作为可执行字符,而不是字符串值
func (*MysqlClient) GetAll ¶
func (this *MysqlClient) GetAll(_sql string, val ...interface{}) []map[string]interface{}
func (*MysqlClient) GetOne ¶
func (this *MysqlClient) GetOne(_sql string, val ...interface{}) interface{}
GetOne {{{
func (*MysqlClient) GetRow ¶
func (this *MysqlClient) GetRow(_sql string, val ...interface{}) map[string]interface{}
GetRow {{{
func (*MysqlClient) Insert ¶
func (this *MysqlClient) Insert(table string, vals map[string]interface{}) int
Insert{{{
func (*MysqlClient) Replace ¶
func (this *MysqlClient) Replace(table string, vals map[string]interface{}) int
Replace {{{
func (*MysqlClient) Rollback ¶
func (this *MysqlClient) Rollback()
func (*MysqlClient) SetDebug ¶
func (this *MysqlClient) SetDebug(open bool)
type MysqlExplain ¶
type MysqlExplain struct {
// contains filtered or unexported fields
}
func (*MysqlExplain) DrawConsole ¶
func (this *MysqlExplain) DrawConsole()
type MysqlProxy ¶
type MysqlProxy struct {
// contains filtered or unexported fields
}
func (*MysqlProxy) Add ¶
func (this *MysqlProxy) Add(conf_name string)
func (*MysqlProxy) Get ¶
func (this *MysqlProxy) Get(conf_name string) *MysqlClient
type RedisClient ¶
type RedisClient struct { Host string Password string Timeout int Poolsize int // contains filtered or unexported fields }
func (*RedisClient) Blpop ¶
func (this *RedisClient) Blpop(key string, timeout int) (val []string, err error)
{{{ Blpop
func (*RedisClient) Brpop ¶
func (this *RedisClient) Brpop(key string, timeout int) (val []string, err error)
{{{ Brpop
func (*RedisClient) Call ¶
func (this *RedisClient) Call(cmd string, args ...interface{}) (resp *redis.Resp, err error)
__call {{{ Call
func (*RedisClient) Decrby ¶
func (this *RedisClient) Decrby(key string, increment int) (val int, err error)
{{{ decrby
func (*RedisClient) Expire ¶
func (this *RedisClient) Expire(key string, expire int) error
{{{ Expire
func (*RedisClient) ExpireAt ¶
func (this *RedisClient) ExpireAt(key string, timestamp int)
{{{ ExpireAt
func (*RedisClient) Hexists ¶
func (this *RedisClient) Hexists(key string) (bool, error)
{{{ Hexists
func (*RedisClient) Hget ¶
func (this *RedisClient) Hget(key string, field interface{}) (val string, err error)
{{{ Hget
func (*RedisClient) HgetAll ¶
func (this *RedisClient) HgetAll(key string) (val map[string]string, err error)
{{{ HgetAll
func (*RedisClient) Hincrby ¶
func (this *RedisClient) Hincrby(key string, field interface{}, increment int) (val int, err error)
{{{ Hincrby
func (*RedisClient) HincrbyFloat ¶
func (this *RedisClient) HincrbyFloat(key string, field interface{}, increment interface{}) (val float64, err error)
{{{ HincrbyFloat
func (*RedisClient) Hkeys ¶
func (this *RedisClient) Hkeys(key string) (val []string, err error)
{{{ Hkeys
func (*RedisClient) Hmget ¶
func (this *RedisClient) Hmget(key string, fields interface{}) (val []string, err error)
{{{ Hmget
func (*RedisClient) Hmset ¶
func (this *RedisClient) Hmset(key string, val interface{}) (err error)
{{{ Hmset
func (*RedisClient) Hscan ¶
func (this *RedisClient) Hscan(key string, cursor, pattern, count interface{}) (val []string, err error)
{{{ Hscan
func (*RedisClient) Hset ¶
func (this *RedisClient) Hset(key string, field interface{}, val interface{}) error
hash {{{ Hset
func (*RedisClient) Hsetnx ¶
func (this *RedisClient) Hsetnx(key string, field interface{}, val interface{}) (err error)
{{{ Hsetnx
func (*RedisClient) Incrby ¶
func (this *RedisClient) Incrby(key string, increment int) (val int, err error)
{{{ incrby
func (*RedisClient) IncrbyFloat ¶
func (this *RedisClient) IncrbyFloat(key string, increment interface{}) (val float64, err error)
{{{ incrbyfloat
func (*RedisClient) Keys ¶
func (this *RedisClient) Keys(key string) (val []string, err error)
{{{ Keys
func (*RedisClient) Lpop ¶
func (this *RedisClient) Lpop(key string) (val string, err error)
{{{ Lpop
func (*RedisClient) Lpush ¶
func (this *RedisClient) Lpush(key string, val interface{}) error
{{{ Lpush
func (*RedisClient) Lrange ¶
func (this *RedisClient) Lrange(key string, start, stop int) (val []string, err error)
{{{ Lrange key start stop
func (*RedisClient) Mget ¶
func (this *RedisClient) Mget(keys []string) (val []string, err error)
{{{ Mget
func (*RedisClient) Rpop ¶
func (this *RedisClient) Rpop(key string) (val string, err error)
{{{ Rpop
func (*RedisClient) Rpush ¶
func (this *RedisClient) Rpush(key string, val interface{}) error
list {{{ Rpush
func (*RedisClient) Sadd ¶
func (this *RedisClient) Sadd(key string, val interface{}) error
sets {{{ Sadd
func (*RedisClient) Scan ¶
func (this *RedisClient) Scan(cursor, pattern, count string) (val []string, err error)
{{{ Scan
func (*RedisClient) Scard ¶
func (this *RedisClient) Scard(key string) (val int, err error)
{{{ Scard
func (*RedisClient) Setex ¶
func (this *RedisClient) Setex(key string, secs int, val interface{}) error
{{{ Setex
func (*RedisClient) SisMember ¶
func (this *RedisClient) SisMember(key string, member interface{}) (bool, error)
{{{ SisMember
func (*RedisClient) Smembers ¶
func (this *RedisClient) Smembers(key string) (val []string, err error)
{{{ Smembers
func (*RedisClient) Spop ¶
func (this *RedisClient) Spop(key, count int) (val []string, err error)
{{{ Spop
func (*RedisClient) SrandMember ¶
func (this *RedisClient) SrandMember(key, count int) (val []string, err error)
{{{ SrandMember
func (*RedisClient) Srem ¶
func (this *RedisClient) Srem(key string, member interface{}) (val int, err error)
{{{ Srem
func (*RedisClient) Sscan ¶
func (this *RedisClient) Sscan(key string, cursor, pattern, count interface{}) (val []string, err error)
{{{ Sscan
func (*RedisClient) Zadd ¶
func (this *RedisClient) Zadd(key string, score int, val interface{}) error
zset {{{ Zadd
func (*RedisClient) Zcard ¶
func (this *RedisClient) Zcard(key string) (val int, err error)
{{{ Zcard
func (*RedisClient) Zincrby ¶
func (this *RedisClient) Zincrby(key string, increment int, val interface{}) error
{{{ Zincrby
func (*RedisClient) Zrange ¶
func (this *RedisClient) Zrange(key string, start, stop int, withscores bool) (val []string, err error)
{{{ Zrange key start stop [WITHSCORES]
func (*RedisClient) ZrangeByScore ¶
func (this *RedisClient) ZrangeByScore(key string, min, max, start, step int, withscores bool) (val []string, err error)
{{{ ZrangeByScore key min max [WITHSCORES] [LIMIT offset count] 返回有序集 key 中,所有 score 值介于 min 和 max 之间(包括等于 min 或 max )的成员。按 score 值递增(从小到大)次序排列。
func (*RedisClient) ZrangeBytes ¶
func (this *RedisClient) ZrangeBytes(key string, start, stop int, withscores bool) (val [][]byte, err error)
{{{ ZrangeBytes key start stop [WITHSCORES]
func (*RedisClient) Zrank ¶
func (this *RedisClient) Zrank(key string, member interface{}) (val int, err error)
{{{ Zrank
func (*RedisClient) Zrem ¶
func (this *RedisClient) Zrem(key string, member interface{}) (val int, err error)
{{{ Zrem
func (*RedisClient) ZremrangeByScore ¶
func (this *RedisClient) ZremrangeByScore(key string, min, max int) (err error)
{{{ ZremrangeByScore
func (*RedisClient) Zrevrange ¶
func (this *RedisClient) Zrevrange(key string, start, stop int, withscores bool) (val []string, err error)
{{{ Zrevrange key start stop [WITHSCORES]
func (*RedisClient) ZrevrangeByScore ¶
func (this *RedisClient) ZrevrangeByScore(key string, start, step int, withscores bool) (val []string, err error)
{{{ ZrevrangeByScore key max min [WITHSCORES] [LIMIT offset count]
func (*RedisClient) ZrevrangeBytes ¶
func (this *RedisClient) ZrevrangeBytes(key string, start, stop int, withscores bool) (val [][]byte, err error)
{{{ ZrevrangeBytes key start stop [WITHSCORES]
type RedisProxy ¶
type RedisProxy struct {
// contains filtered or unexported fields
}
type Restrict ¶
type Restrict struct { Rule string Freq int //频率 Interval int //周期 Whitelist []string Blacklist []string CacheType int RedisConf string }
func NewRestrict ¶
func (*Restrict) AddBlacklist ¶
func (*Restrict) AddWhitelist ¶
type RpcServer ¶
http服务监听,路由
func (*RpcServer) AddController ¶
func (this *RpcServer) AddController(c interface{})
func (*RpcServer) Run ¶
func (this *RpcServer) Run()
func (this *RpcServer) Run() { //runtime.GOMAXPROCS(runtime.NumCPU()) lis, err := net.Listen("tcp", fmt.Sprintf(":%d", this.Port)) if err != nil { panic(err) } s := grpc.NewServer() pb.RegisterYGOServiceServer(s, this.hanlder) fmt.Println("RpcServer Listen: ", this.Port) s.Serve(lis) }
run with endless