This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package server
import (
"github.com/noahlann/nnet/pkg/config"
)
// UDPServer UDP服务器(使用统一的gnetServer)
type UDPServer struct {
*Server
}
// NewUDPServer 创建UDP服务器
func NewUDPServer(cfg *config.Config) (*UDPServer, error) {
// 创建统一的gnet服务器(UDP模式)
gnetSrv, err := newGnetServer(cfg, ProtocolUDP)
if err != nil {
return nil, err
return &UDPServer{
Server: newServerWithGnet(gnetSrv, cfg),
}, nil