mirror of
https://github.com/speatzle/nfsense.git
synced 2025-09-13 15:19:08 +00:00
fix matcher generation
This commit is contained in:
parent
06a0d20404
commit
4479627a00
2 changed files with 15 additions and 15 deletions
|
@ -17,21 +17,21 @@ type Service struct {
|
|||
}
|
||||
|
||||
func (s Service) GetSPort() string {
|
||||
if *s.SPortStart == 0 {
|
||||
if s.SPortStart == nil || *s.SPortStart == 0 {
|
||||
return ""
|
||||
} else if *s.SPortEnd == 0 {
|
||||
return fmt.Sprintf("sport %d", *s.SPortStart)
|
||||
} else if s.SPortEnd == nil || *s.SPortEnd == 0 {
|
||||
return fmt.Sprintf("%d", *s.SPortStart)
|
||||
}
|
||||
return fmt.Sprintf("sport %d - %d", *s.SPortStart, *s.SPortEnd)
|
||||
return fmt.Sprintf("%d - %d", *s.SPortStart, *s.SPortEnd)
|
||||
}
|
||||
|
||||
func (s Service) GetDPort() string {
|
||||
if *s.DPortStart == 0 {
|
||||
if s.DPortStart == nil || *s.DPortStart == 0 {
|
||||
return ""
|
||||
} else if *s.DPortEnd == 0 {
|
||||
return fmt.Sprintf("dport %d", *s.DPortStart)
|
||||
} else if s.DPortEnd == nil || *s.DPortEnd == 0 {
|
||||
return fmt.Sprintf("%d", *s.DPortStart)
|
||||
}
|
||||
return fmt.Sprintf("dport %d - %d", *s.DPortStart, *s.DPortEnd)
|
||||
return fmt.Sprintf("%d - %d", *s.DPortStart, *s.DPortEnd)
|
||||
}
|
||||
|
||||
type ServiceType int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue