Skip to content

Commit 885762a

Browse files
committed
Make linter happy (Udp -> UDP)
1 parent 850866e commit 885762a

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

ovs/match.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -917,35 +917,35 @@ func TransportDestinationMaskedPort(port uint16, mask uint16) Match {
917917
}
918918
}
919919

920-
// UdpSourcePort matches packets with a UDP source port matching port.
921-
func UdpSourcePort(port uint16) Match {
920+
// UDPSourcePort matches packets with a UDP source port matching port.
921+
func UDPSourcePort(port uint16) Match {
922922
return &udpPortMatch{
923923
srcdst: source,
924924
port: port,
925925
mask: 0,
926926
}
927927
}
928928

929-
// UdpDestinationPort matches packets with a UDP destination port matching port.
930-
func UdpDestinationPort(port uint16) Match {
929+
// UDPDestinationPort matches packets with a UDP destination port matching port.
930+
func UDPDestinationPort(port uint16) Match {
931931
return &udpPortMatch{
932932
srcdst: destination,
933933
port: port,
934934
mask: 0,
935935
}
936936
}
937937

938-
// UdpSourceMaskedPort matches packets with UDP source port matching a masked port range.
939-
func UdpSourceMaskedPort(port uint16, mask uint16) Match {
938+
// UDPSourceMaskedPort matches packets with UDP source port matching a masked port range.
939+
func UDPSourceMaskedPort(port uint16, mask uint16) Match {
940940
return &udpPortMatch{
941941
srcdst: source,
942942
port: port,
943943
mask: mask,
944944
}
945945
}
946946

947-
// UdpDestinationMaskedPort matches packets with a UDP destination port matching a masked port range.
948-
func UdpDestinationMaskedPort(port uint16, mask uint16) Match {
947+
// UDPDestinationMaskedPort matches packets with a UDP destination port matching a masked port range.
948+
func UDPDestinationMaskedPort(port uint16, mask uint16) Match {
949949
return &udpPortMatch{
950950
srcdst: destination,
951951
port: port,
@@ -969,17 +969,17 @@ type udpPortRange struct {
969969
endPort uint16
970970
}
971971

972-
// UdpDestinationPortRange represent a port range intended for a UDP protocol destination port.
973-
func UdpDestinationPortRange(startPort uint16, endPort uint16) TransportPortRanger {
972+
// UDPDestinationPortRange represent a port range intended for a UDP protocol destination port.
973+
func UDPDestinationPortRange(startPort uint16, endPort uint16) TransportPortRanger {
974974
return &udpPortRange{
975975
srcdst: destination,
976976
startPort: startPort,
977977
endPort: endPort,
978978
}
979979
}
980980

981-
// UdpSourcePortRange represent a port range intended for a UDP protocol source port.
982-
func UdpSourcePortRange(startPort uint16, endPort uint16) TransportPortRanger {
981+
// UDPSourcePortRange represent a port range intended for a UDP protocol source port.
982+
func UDPSourcePortRange(startPort uint16, endPort uint16) TransportPortRanger {
983983
return &udpPortRange{
984984
srcdst: source,
985985
startPort: startPort,
@@ -1015,7 +1015,7 @@ func (pr *udpPortRange) MaskedPorts() ([]Match, error) {
10151015

10161016
// MarshalText implements Match.
10171017
func (m *udpPortMatch) MarshalText() ([]byte, error) {
1018-
return matchUdpPort(m.srcdst, m.port, m.mask)
1018+
return matchUDPPort(m.srcdst, m.port, m.mask)
10191019
}
10201020

10211021
// GoString implements Match.
@@ -1607,9 +1607,9 @@ func matchTransportPort(srcdst string, port uint16, mask uint16) ([]byte, error)
16071607
return bprintf("tp_%s=0x%04x/0x%04x", srcdst, port, mask), nil
16081608
}
16091609

1610-
// matchUdpPort is the common implementation for
1610+
// matchUDPPort is the common implementation for
16111611
// Udp{Source,Destination}Port.
1612-
func matchUdpPort(srcdst string, port uint16, mask uint16) ([]byte, error) {
1612+
func matchUDPPort(srcdst string, port uint16, mask uint16) ([]byte, error) {
16131613
// No mask specified
16141614
if mask == 0 {
16151615
return bprintf("udp_%s=%d", srcdst, port), nil

ovs/match_test.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -930,32 +930,32 @@ func TestMatchUdp(t *testing.T) {
930930
}{
931931
{
932932
desc: "source port 80",
933-
m: UdpSourcePort(80),
933+
m: UDPSourcePort(80),
934934
out: "udp_src=80",
935935
},
936936
{
937937
desc: "source port 65535",
938-
m: UdpSourcePort(65535),
938+
m: UDPSourcePort(65535),
939939
out: "udp_src=65535",
940940
},
941941
{
942942
desc: "destination port 22",
943-
m: UdpDestinationPort(22),
943+
m: UDPDestinationPort(22),
944944
out: "udp_dst=22",
945945
},
946946
{
947947
desc: "destination port 8080",
948-
m: UdpDestinationPort(8080),
948+
m: UDPDestinationPort(8080),
949949
out: "udp_dst=8080",
950950
},
951951
{
952952
desc: "source port range 16/0xfff0 (16-31)",
953-
m: UdpSourceMaskedPort(0x10, 0xfff0),
953+
m: UDPSourceMaskedPort(0x10, 0xfff0),
954954
out: "udp_src=0x0010/0xfff0",
955955
},
956956
{
957957
desc: "destination port range 16/0xfff0 (16-31)",
958-
m: UdpDestinationMaskedPort(0x10, 0xfff0),
958+
m: UDPDestinationMaskedPort(0x10, 0xfff0),
959959
out: "udp_dst=0x0010/0xfff0",
960960
},
961961
}
@@ -983,32 +983,32 @@ func TestMatchUdpPortRange(t *testing.T) {
983983
}{
984984
{
985985
desc: "destination port range 16-31",
986-
pr: UdpDestinationPortRange(16, 31),
986+
pr: UDPDestinationPortRange(16, 31),
987987
m: []Match{
988-
UdpDestinationMaskedPort(0x10, 0xfff0),
988+
UDPDestinationMaskedPort(0x10, 0xfff0),
989989
},
990990
},
991991
{
992992
desc: "source port range 16-31",
993-
pr: UdpSourcePortRange(16, 31),
993+
pr: UDPSourcePortRange(16, 31),
994994
m: []Match{
995-
UdpSourceMaskedPort(0x10, 0xfff0),
995+
UDPSourceMaskedPort(0x10, 0xfff0),
996996
},
997997
},
998998
{
999999
desc: "destination port range 16-32",
1000-
pr: UdpDestinationPortRange(16, 32),
1000+
pr: UDPDestinationPortRange(16, 32),
10011001
m: []Match{
1002-
UdpDestinationMaskedPort(0x10, 0xfff0),
1003-
UdpDestinationMaskedPort(0x20, 0xffff),
1002+
UDPDestinationMaskedPort(0x10, 0xfff0),
1003+
UDPDestinationMaskedPort(0x20, 0xffff),
10041004
},
10051005
},
10061006
{
10071007
desc: "source port range 16-32",
1008-
pr: UdpSourcePortRange(16, 32),
1008+
pr: UDPSourcePortRange(16, 32),
10091009
m: []Match{
1010-
UdpSourceMaskedPort(0x10, 0xfff0),
1011-
UdpSourceMaskedPort(0x20, 0xffff),
1010+
UDPSourceMaskedPort(0x10, 0xfff0),
1011+
UDPSourceMaskedPort(0x20, 0xffff),
10121012
},
10131013
},
10141014
}

ovs/matchparser.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ func parsePort(key string, value string, max int) (Match, error) {
216216
case tpDST:
217217
return TransportDestinationMaskedPort(uint16(values[0]), uint16(values[1])), nil
218218
case udpSRC:
219-
return UdpSourceMaskedPort(uint16(values[0]), uint16(values[1])), nil
219+
return UDPSourceMaskedPort(uint16(values[0]), uint16(values[1])), nil
220220
case udpDST:
221-
return UdpDestinationMaskedPort(uint16(values[0]), uint16(values[1])), nil
221+
return UDPDestinationMaskedPort(uint16(values[0]), uint16(values[1])), nil
222222
}
223223
// Return error if input is invalid
224224
return nil, fmt.Errorf("no action matched for %s=%s", key, value)

ovs/matchparser_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,15 @@ func Test_parseMatch(t *testing.T) {
236236
},
237237
{
238238
s: "udp_dst=80",
239-
m: UdpDestinationPort(80),
239+
m: UDPDestinationPort(80),
240240
},
241241
{
242242
s: "udp_src=65536",
243243
invalid: true,
244244
},
245245
{
246246
s: "udp_src=80",
247-
m: UdpSourcePort(80),
247+
m: UDPSourcePort(80),
248248
},
249249
{
250250
s: "vlan_tci=",
@@ -515,7 +515,7 @@ func Test_parseMatch(t *testing.T) {
515515
{
516516
desc: "udp_dst 0xea60/0xffe0",
517517
s: "udp_dst=0xea60/0xffe0",
518-
m: UdpDestinationMaskedPort(0xea60, 0xffe0),
518+
m: UDPDestinationMaskedPort(0xea60, 0xffe0),
519519
},
520520
{
521521
desc: "udp_dst 0xea60/0xffe0/0xdddd",
@@ -540,7 +540,7 @@ func Test_parseMatch(t *testing.T) {
540540
{
541541
desc: "udp_src 0xea60/0xffe0",
542542
s: "udp_src=0xea60/0xffe0",
543-
m: UdpSourceMaskedPort(0xea60, 0xffe0),
543+
m: UDPSourceMaskedPort(0xea60, 0xffe0),
544544
},
545545
{
546546
desc: "udp_src 0xea60/0xffe0/0xdddd",

0 commit comments

Comments
 (0)