-
Notifications
You must be signed in to change notification settings - Fork 0
/
rules.go
59 lines (47 loc) · 1.82 KB
/
rules.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright (C) 2023 Kendall Tauser
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package netlink
import (
"context"
api "github.com/fire833/morfic/pkg/ipcapi/v1alpha1"
"github.com/fire833/morfic/pkg/node/locks"
"github.com/vishvananda/netlink"
)
func (s *NetlinkNodeServer) GetRule(ctx context.Context, req *api.GetRuleRequest) (resp *api.GetRuleResponse, err error) {
return nil, nil
}
func (s *NetlinkNodeServer) GetAllRules(ctx context.Context, req *api.GetAllRulesRequest) (resp *api.GetAllRulesResponse, err error) {
tl := locks.TableLock
tl.RLock()
if _, e := netlink.RuleList(0); e != nil {
tl.RUnlock()
return &api.GetAllRulesResponse{}, nil
} else {
tl.RUnlock()
return &api.GetAllRulesResponse{}, nil
}
}
func (s *NetlinkNodeServer) DeleteRule(ctx context.Context, req *api.DeleteRuleRequest) (resp *api.DeleteRuleResponse, err error) {
return nil, nil
}
func (s *NetlinkNodeServer) CreateRule(ctx context.Context, req *api.CreateRuleRequest) (resp *api.CreateRuleResponse, err error) {
return nil, nil
}
func (s *NetlinkNodeServer) UpdateRule(ctx context.Context, req *api.UpdateRuleRequest) (resp *api.UpdateRuleResponse, err error) {
return nil, nil
}