github.com/godevsig/adaptiveservice@v0.9.23/server_options.go (about) 1 package adaptiveservice 2 3 import "strings" 4 5 // SetPublisher declares the publisher of the server, which for example 6 // is usually an organization name. The name should not contain "_" or "/". 7 // Default is "default.org". 8 func (s *Server) SetPublisher(publisher string) *Server { 9 if strings.ContainsAny(publisher, "_/") { 10 panic("publisher should not contain _ or /") 11 } 12 s.publisher = publisher 13 return s 14 } 15 16 // SetScaleFactors sets the scale factors to be applied on the internal message queue. 17 // residentWorkers: the number of resident workers. Default is 1. 18 // qSizePerCore: the internal message queue size per core. Default is 32. 19 // A Server has one internal message queue, messages received from transport layer are put into 20 // the queue, a number of workers get message from the queue and handle it. 21 // The number of wokers scales automatically from residentWorkers to qSizePerCore * core number. 22 func (s *Server) SetScaleFactors(residentWorkers, qSizePerCore int) *Server { 23 s.residentWorkers = residentWorkers 24 s.qSizePerCore = qSizePerCore 25 return s 26 } 27 28 // SetBroadcastPort sets the broadcast port used by lan registry. 29 func (s *Server) SetBroadcastPort(port string) *Server { 30 s.broadcastPort = port 31 return s 32 } 33 34 // DisableMsgTypeCheck disables message type checking for incoming messages. 35 func (s *Server) DisableMsgTypeCheck() *Server { 36 s.msgTypeCheck = false 37 return s 38 } 39 40 // EnableRootRegistry makes the server become root registry. 41 func (s *Server) EnableRootRegistry() *Server { 42 s.rootRegistry = true 43 return s 44 } 45 46 // EnableAutoReverseProxy tries to enable reverse proxy. 47 func (s *Server) EnableAutoReverseProxy() *Server { 48 s.autoReverseProxy = true 49 return s 50 } 51 52 // EnableServiceLister enables lister service which can list 53 // available services. 54 func (s *Server) EnableServiceLister() *Server { 55 s.serviceLister = true 56 return s 57 } 58 59 // EnableIPObserver enables IP observer service which helps the 60 // requesting client to find out its observed IP address. 61 func (s *Server) EnableIPObserver() *Server { 62 s.ipObserver = true 63 return s 64 }