github.com/cmd-stream/base-go@v0.0.0-20230813145615-dd6ac24c16f5/server/conf.go (about) 1 package server 2 3 import ( 4 "net" 5 "time" 6 ) 7 8 // LostConnCallback is called when Server loses connection with the client. 9 type LostConnCallback = func(addr net.Addr, err error) 10 11 // Conf is a base Server configuration. 12 // 13 // Workerscount parameter must > 0. LostConnCallback may be nil. 14 type Conf struct { 15 ConnReceiverConf 16 WorkersCount int 17 LostConnCallback LostConnCallback 18 } 19 20 // ConnReceiverConf is a ConnReceiver configuration. 21 // 22 // FirstConnTimeout defines the time during which Server should accept the 23 // first connection, if == 0 waits forever. 24 type ConnReceiverConf struct { 25 FirstConnTimeout time.Duration 26 }