You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
464 B
Go

This file contains ambiguous Unicode characters!

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
}