Rename all Udp and Tcp to UDP and TCP to follow Golang coding standards

This commit is contained in:
Ola Bini 2019-12-21 17:38:29 +00:00
parent c7c9cedd38
commit 6fae18a9cd
No known key found for this signature in database
GPG key ID: 6786A150F6A2B28F
4 changed files with 74 additions and 74 deletions

View file

@ -49,12 +49,12 @@ type Client struct {
voiceTargets map[uint32]*VoiceTarget voiceTargets map[uint32]*VoiceTarget
// Ping stats // Ping stats
UdpPingAvg float32 UDPPingAvg float32
UdpPingVar float32 UDPPingVar float32
UdpPackets uint32 UDPPackets uint32
TcpPingAvg float32 TCPPingAvg float32
TcpPingVar float32 TCPPingVar float32
TcpPackets uint32 TCPPackets uint32
// If the client is a registered user on the server, // If the client is a registered user on the server,
// the user field will point to the registration record. // the user field will point to the registration record.

View file

@ -87,24 +87,24 @@ func (server *Server) handlePingMessage(client *Client, msg *Message) {
client.crypt.RemoteResync = *ping.Resync client.crypt.RemoteResync = *ping.Resync
} }
if ping.UdpPingAvg != nil { if ping.UDPPingAvg != nil {
client.UdpPingAvg = *ping.UdpPingAvg client.UDPPingAvg = *ping.UDPPingAvg
} }
if ping.UdpPingVar != nil { if ping.UDPPingVar != nil {
client.UdpPingVar = *ping.UdpPingVar client.UDPPingVar = *ping.UDPPingVar
} }
if ping.UdpPackets != nil { if ping.UDPPackets != nil {
client.UdpPackets = *ping.UdpPackets client.UDPPackets = *ping.UDPPackets
} }
if ping.TcpPingAvg != nil { if ping.TCPPingAvg != nil {
client.TcpPingAvg = *ping.TcpPingAvg client.TCPPingAvg = *ping.TCPPingAvg
} }
if ping.TcpPingVar != nil { if ping.TCPPingVar != nil {
client.TcpPingVar = *ping.TcpPingVar client.TCPPingVar = *ping.TCPPingVar
} }
if ping.TcpPackets != nil { if ping.TCPPackets != nil {
client.TcpPackets = *ping.TcpPackets client.TCPPackets = *ping.TCPPackets
} }
client.sendMessage(&mumbleproto.Ping{ client.sendMessage(&mumbleproto.Ping{
@ -1358,12 +1358,12 @@ func (server *Server) handleUserStatsMessage(client *Client, msg *Message) {
stats.FromServer = fromServer stats.FromServer = fromServer
} }
stats.UdpPackets = proto.Uint32(target.UdpPackets) stats.UDPPackets = proto.Uint32(target.UDPPackets)
stats.TcpPackets = proto.Uint32(target.TcpPackets) stats.TCPPackets = proto.Uint32(target.TCPPackets)
stats.UdpPingAvg = proto.Float32(target.UdpPingAvg) stats.UDPPingAvg = proto.Float32(target.UDPPingAvg)
stats.UdpPingVar = proto.Float32(target.UdpPingVar) stats.UDPPingVar = proto.Float32(target.UDPPingVar)
stats.TcpPingAvg = proto.Float32(target.TcpPingAvg) stats.TCPPingAvg = proto.Float32(target.TCPPingAvg)
stats.TcpPingVar = proto.Float32(target.TcpPingVar) stats.TCPPingVar = proto.Float32(target.TCPPingVar)
if details { if details {
version := &mumbleproto.Version{} version := &mumbleproto.Version{}

View file

@ -1002,12 +1002,12 @@ func (server *Server) udpListenLoop() {
} }
} else { } else {
server.handleUdpPacket(udpaddr, buf[0:nread]) server.handleUDPPacket(udpaddr, buf[0:nread])
} }
} }
} }
func (server *Server) handleUdpPacket(udpaddr *net.UDPAddr, buf []byte) { func (server *Server) handleUDPPacket(udpaddr *net.UDPAddr, buf []byte) {
var match *Client var match *Client
plain := make([]byte, len(buf)) plain := make([]byte, len(buf))

View file

@ -410,17 +410,17 @@ type Ping struct {
// The amount of nonce resyncs. // The amount of nonce resyncs.
Resync *uint32 `protobuf:"varint,5,opt,name=resync" json:"resync,omitempty"` Resync *uint32 `protobuf:"varint,5,opt,name=resync" json:"resync,omitempty"`
// The total amount of UDP packets received. // The total amount of UDP packets received.
UdpPackets *uint32 `protobuf:"varint,6,opt,name=udp_packets,json=udpPackets" json:"udp_packets,omitempty"` UDPPackets *uint32 `protobuf:"varint,6,opt,name=udp_packets,json=udpPackets" json:"udp_packets,omitempty"`
// The total amount of TCP packets received. // The total amount of TCP packets received.
TcpPackets *uint32 `protobuf:"varint,7,opt,name=tcp_packets,json=tcpPackets" json:"tcp_packets,omitempty"` TCPPackets *uint32 `protobuf:"varint,7,opt,name=tcp_packets,json=tcpPackets" json:"tcp_packets,omitempty"`
// UDP ping average. // UDP ping average.
UdpPingAvg *float32 `protobuf:"fixed32,8,opt,name=udp_ping_avg,json=udpPingAvg" json:"udp_ping_avg,omitempty"` UDPPingAvg *float32 `protobuf:"fixed32,8,opt,name=udp_ping_avg,json=udpPingAvg" json:"udp_ping_avg,omitempty"`
// UDP ping variance. // UDP ping variance.
UdpPingVar *float32 `protobuf:"fixed32,9,opt,name=udp_ping_var,json=udpPingVar" json:"udp_ping_var,omitempty"` UDPPingVar *float32 `protobuf:"fixed32,9,opt,name=udp_ping_var,json=udpPingVar" json:"udp_ping_var,omitempty"`
// TCP ping average. // TCP ping average.
TcpPingAvg *float32 `protobuf:"fixed32,10,opt,name=tcp_ping_avg,json=tcpPingAvg" json:"tcp_ping_avg,omitempty"` TCPPingAvg *float32 `protobuf:"fixed32,10,opt,name=tcp_ping_avg,json=tcpPingAvg" json:"tcp_ping_avg,omitempty"`
// TCP ping variance. // TCP ping variance.
TcpPingVar *float32 `protobuf:"fixed32,11,opt,name=tcp_ping_var,json=tcpPingVar" json:"tcp_ping_var,omitempty"` TCPPingVar *float32 `protobuf:"fixed32,11,opt,name=tcp_ping_var,json=tcpPingVar" json:"tcp_ping_var,omitempty"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
} }
@ -464,44 +464,44 @@ func (m *Ping) GetResync() uint32 {
return 0 return 0
} }
func (m *Ping) GetUdpPackets() uint32 { func (m *Ping) GetUDPPackets() uint32 {
if m != nil && m.UdpPackets != nil { if m != nil && m.UDPPackets != nil {
return *m.UdpPackets return *m.UDPPackets
} }
return 0 return 0
} }
func (m *Ping) GetTcpPackets() uint32 { func (m *Ping) GetTCPPackets() uint32 {
if m != nil && m.TcpPackets != nil { if m != nil && m.TCPPackets != nil {
return *m.TcpPackets return *m.TCPPackets
} }
return 0 return 0
} }
func (m *Ping) GetUdpPingAvg() float32 { func (m *Ping) GetUDPPingAvg() float32 {
if m != nil && m.UdpPingAvg != nil { if m != nil && m.UDPPingAvg != nil {
return *m.UdpPingAvg return *m.UDPPingAvg
} }
return 0 return 0
} }
func (m *Ping) GetUdpPingVar() float32 { func (m *Ping) GetUDPPingVar() float32 {
if m != nil && m.UdpPingVar != nil { if m != nil && m.UDPPingVar != nil {
return *m.UdpPingVar return *m.UDPPingVar
} }
return 0 return 0
} }
func (m *Ping) GetTcpPingAvg() float32 { func (m *Ping) GetTCPPingAvg() float32 {
if m != nil && m.TcpPingAvg != nil { if m != nil && m.TCPPingAvg != nil {
return *m.TcpPingAvg return *m.TCPPingAvg
} }
return 0 return 0
} }
func (m *Ping) GetTcpPingVar() float32 { func (m *Ping) GetTCPPingVar() float32 {
if m != nil && m.TcpPingVar != nil { if m != nil && m.TCPPingVar != nil {
return *m.TcpPingVar return *m.TCPPingVar
} }
return 0 return 0
} }
@ -1795,17 +1795,17 @@ type UserStats struct {
// Packet statistics for packets sent by the server. // Packet statistics for packets sent by the server.
FromServer *UserStats_Stats `protobuf:"bytes,5,opt,name=from_server,json=fromServer" json:"from_server,omitempty"` FromServer *UserStats_Stats `protobuf:"bytes,5,opt,name=from_server,json=fromServer" json:"from_server,omitempty"`
// Amount of UDP packets sent. // Amount of UDP packets sent.
UdpPackets *uint32 `protobuf:"varint,6,opt,name=udp_packets,json=udpPackets" json:"udp_packets,omitempty"` UDPPackets *uint32 `protobuf:"varint,6,opt,name=udp_packets,json=udpPackets" json:"udp_packets,omitempty"`
// Amount of TCP packets sent. // Amount of TCP packets sent.
TcpPackets *uint32 `protobuf:"varint,7,opt,name=tcp_packets,json=tcpPackets" json:"tcp_packets,omitempty"` TCPPackets *uint32 `protobuf:"varint,7,opt,name=tcp_packets,json=tcpPackets" json:"tcp_packets,omitempty"`
// UDP ping average. // UDP ping average.
UdpPingAvg *float32 `protobuf:"fixed32,8,opt,name=udp_ping_avg,json=udpPingAvg" json:"udp_ping_avg,omitempty"` UDPPingAvg *float32 `protobuf:"fixed32,8,opt,name=udp_ping_avg,json=udpPingAvg" json:"udp_ping_avg,omitempty"`
// UDP ping variance. // UDP ping variance.
UdpPingVar *float32 `protobuf:"fixed32,9,opt,name=udp_ping_var,json=udpPingVar" json:"udp_ping_var,omitempty"` UDPPingVar *float32 `protobuf:"fixed32,9,opt,name=udp_ping_var,json=udpPingVar" json:"udp_ping_var,omitempty"`
// TCP ping average. // TCP ping average.
TcpPingAvg *float32 `protobuf:"fixed32,10,opt,name=tcp_ping_avg,json=tcpPingAvg" json:"tcp_ping_avg,omitempty"` TCPPingAvg *float32 `protobuf:"fixed32,10,opt,name=tcp_ping_avg,json=tcpPingAvg" json:"tcp_ping_avg,omitempty"`
// TCP ping variance. // TCP ping variance.
TcpPingVar *float32 `protobuf:"fixed32,11,opt,name=tcp_ping_var,json=tcpPingVar" json:"tcp_ping_var,omitempty"` TCPPingVar *float32 `protobuf:"fixed32,11,opt,name=tcp_ping_var,json=tcpPingVar" json:"tcp_ping_var,omitempty"`
// Client version. // Client version.
Version *Version `protobuf:"bytes,12,opt,name=version" json:"version,omitempty"` Version *Version `protobuf:"bytes,12,opt,name=version" json:"version,omitempty"`
// A list of CELT bitstream version constants supported by the client of this // A list of CELT bitstream version constants supported by the client of this
@ -1869,44 +1869,44 @@ func (m *UserStats) GetFromServer() *UserStats_Stats {
return nil return nil
} }
func (m *UserStats) GetUdpPackets() uint32 { func (m *UserStats) GetUDPPackets() uint32 {
if m != nil && m.UdpPackets != nil { if m != nil && m.UDPPackets != nil {
return *m.UdpPackets return *m.UDPPackets
} }
return 0 return 0
} }
func (m *UserStats) GetTcpPackets() uint32 { func (m *UserStats) GetTCPPackets() uint32 {
if m != nil && m.TcpPackets != nil { if m != nil && m.TCPPackets != nil {
return *m.TcpPackets return *m.TCPPackets
} }
return 0 return 0
} }
func (m *UserStats) GetUdpPingAvg() float32 { func (m *UserStats) GetUDPPingAvg() float32 {
if m != nil && m.UdpPingAvg != nil { if m != nil && m.UDPPingAvg != nil {
return *m.UdpPingAvg return *m.UDPPingAvg
} }
return 0 return 0
} }
func (m *UserStats) GetUdpPingVar() float32 { func (m *UserStats) GetUDPPingVar() float32 {
if m != nil && m.UdpPingVar != nil { if m != nil && m.UDPPingVar != nil {
return *m.UdpPingVar return *m.UDPPingVar
} }
return 0 return 0
} }
func (m *UserStats) GetTcpPingAvg() float32 { func (m *UserStats) GetTCPPingAvg() float32 {
if m != nil && m.TcpPingAvg != nil { if m != nil && m.TCPPingAvg != nil {
return *m.TcpPingAvg return *m.TCPPingAvg
} }
return 0 return 0
} }
func (m *UserStats) GetTcpPingVar() float32 { func (m *UserStats) GetTCPPingVar() float32 {
if m != nil && m.TcpPingVar != nil { if m != nil && m.TCPPingVar != nil {
return *m.TcpPingVar return *m.TCPPingVar
} }
return 0 return 0
} }