Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
K
koko
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
koko
Commits
957dfbb0
Commit
957dfbb0
authored
Jun 21, 2019
by
Eric
Committed by
Eric_Lee
Jun 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update]更新asset的API数据获取
parent
4b65f008
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
assets.go
pkg/model/assets.go
+10
-10
No files found.
pkg/model/assets.go
View file @
957dfbb0
...
@@ -88,7 +88,7 @@ type Asset struct {
...
@@ -88,7 +88,7 @@ type Asset struct {
Platform
string
`json:"platform"`
Platform
string
`json:"platform"`
Comment
string
`json:"comment"`
Comment
string
`json:"comment"`
Protocol
string
`json:"protocol"`
Protocol
string
`json:"protocol"`
Protocols
[]
protocolItem
`json:"protocols,omitempty"`
Protocols
[]
string
`json:"protocols,omitempty"`
OrgID
string
`json:"org_id"`
OrgID
string
`json:"org_id"`
OrgName
string
`json:"org_name"`
OrgName
string
`json:"org_name"`
}
}
...
@@ -99,8 +99,13 @@ func (a *Asset) ProtocolPort(protocol string) int {
...
@@ -99,8 +99,13 @@ func (a *Asset) ProtocolPort(protocol string) int {
return
a
.
Port
return
a
.
Port
}
}
for
_
,
item
:=
range
a
.
Protocols
{
for
_
,
item
:=
range
a
.
Protocols
{
if
strings
.
ToLower
(
item
.
Name
)
==
strings
.
ToLower
(
protocol
)
{
if
strings
.
Contains
(
strings
.
ToLower
(
item
),
strings
.
ToLower
(
protocol
))
{
return
item
.
Port
proAndPort
:=
strings
.
Split
(
item
,
"/"
)
if
len
(
proAndPort
)
==
2
{
if
port
,
err
:=
strconv
.
Atoi
(
proAndPort
[
1
]);
err
==
nil
{
return
port
}
}
}
}
}
}
switch
strings
.
ToLower
(
protocol
)
{
switch
strings
.
ToLower
(
protocol
)
{
...
@@ -120,18 +125,13 @@ func (a *Asset) IsSupportProtocol(protocol string) bool {
...
@@ -120,18 +125,13 @@ func (a *Asset) IsSupportProtocol(protocol string) bool {
return
a
.
Protocol
==
protocol
return
a
.
Protocol
==
protocol
}
}
for
_
,
item
:=
range
a
.
Protocols
{
for
_
,
item
:=
range
a
.
Protocols
{
if
strings
.
ToLower
(
item
.
Name
)
==
strings
.
ToLower
(
protocol
)
{
if
strings
.
Contains
(
strings
.
ToLower
(
item
),
strings
.
ToLower
(
protocol
)
)
{
return
true
return
true
}
}
}
}
return
false
return
false
}
}
type
protocolItem
struct
{
Name
string
`json:"name"`
Port
int
`json:"port"`
}
type
Gateway
struct
{
type
Gateway
struct
{
ID
string
`json:"id"`
ID
string
`json:"id"`
Name
string
`json:"Name"`
Name
string
`json:"Name"`
...
@@ -333,7 +333,7 @@ func (sf *SystemUserFilterRule) Pattern() *regexp.Regexp {
...
@@ -333,7 +333,7 @@ func (sf *SystemUserFilterRule) Pattern() *regexp.Regexp {
func
(
sf
*
SystemUserFilterRule
)
Match
(
cmd
string
)
(
RuleAction
,
string
)
{
func
(
sf
*
SystemUserFilterRule
)
Match
(
cmd
string
)
(
RuleAction
,
string
)
{
pattern
:=
sf
.
Pattern
()
pattern
:=
sf
.
Pattern
()
if
pattern
==
nil
{
if
pattern
==
nil
{
return
ActionUnknown
,
""
return
ActionUnknown
,
""
}
}
found
:=
pattern
.
FindString
(
cmd
)
found
:=
pattern
.
FindString
(
cmd
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment