func (b *broker) RegisterRPC(s *grpc.Server) { server := &brokerRPC{broker: b} server.SetLogger(apex.Wrap(b.Ctx)) server.RouterAssociateChanFunc = server.associateRouter server.HandlerPublishChanFunc = server.getHandlerPublish server.HandlerSubscribeChanFunc = server.getHandlerSubscribe // TODO: Monitor actual rates and configure sensible limits server.routerUpRate = ratelimit.NewRegistry(1000, time.Second) server.handlerDownRate = ratelimit.NewRegistry(125, time.Second) // one eight of uplink pb.RegisterBrokerServer(s, server) }
func (h *handler) RegisterManager(s *grpc.Server) { server := &handlerManager{ handler: h, deviceManager: pb_lorawan.NewDeviceManagerClient(h.ttnBrokerConn), devAddrManager: pb_lorawan.NewDevAddrManagerClient(h.ttnBrokerConn), } server.applicationRate = ratelimit.NewRegistry(5000, time.Hour) server.clientRate = ratelimit.NewRegistry(5000, time.Hour) pb.RegisterHandlerManagerServer(s, server) pb.RegisterApplicationManagerServer(s, server) pb_lorawan.RegisterDevAddrManagerServer(s, server) }
// RegisterManager registers this networkserver as a NetworkServerManagerServer (github.com/TheThingsNetwork/ttn/api/networkserver) func (n *networkServer) RegisterManager(s *grpc.Server) { server := &networkServerManager{networkServer: n} server.clientRate = ratelimit.NewRegistry(5000, time.Hour) pb.RegisterNetworkServerManagerServer(s, server) pb_lorawan.RegisterDeviceManagerServer(s, server) pb_lorawan.RegisterDevAddrManagerServer(s, server) }
// RegisterRPC registers this router as a RouterServer (github.com/TheThingsNetwork/ttn/api/router) func (r *router) RegisterRPC(s *grpc.Server) { server := &routerRPC{router: r} server.SetLogger(apex.Wrap(r.Ctx)) server.UplinkChanFunc = server.getUplink server.DownlinkChanFunc = server.getDownlink server.GatewayStatusChanFunc = server.getGatewayStatus // TODO: Monitor actual rates and configure sensible limits // // The current values are based on the following: // - 20 byte messages on all 6 orthogonal SFs at the same time -> ~1500 msgs/minute // - 8 channels at 5% utilization: 600 msgs/minute // - let's double that and round it to 1500/minute server.uplinkRate = ratelimit.NewRegistry(1500, time.Minute) // includes activations server.statusRate = ratelimit.NewRegistry(10, time.Minute) // 10 per minute (pkt fwd default is 2 per minute) pb.RegisterRouterServer(s, server) }
func (b *broker) RegisterManager(s *grpc.Server) { server := &brokerManager{ broker: b, deviceManager: pb_lorawan.NewDeviceManagerClient(b.nsConn), devAddrManager: pb_lorawan.NewDevAddrManagerClient(b.nsConn), } server.clientRate = ratelimit.NewRegistry(5000, time.Hour) pb.RegisterBrokerManagerServer(s, server) lorawan.RegisterDeviceManagerServer(s, server) lorawan.RegisterDevAddrManagerServer(s, server) }