Skip to content

Commit

Permalink
chore(examples): spilt ip-addr.lua
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
zhaojh329 committed Apr 8, 2024
1 parent d45f275 commit 61a9fd5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 27 deletions.
11 changes: 11 additions & 0 deletions examples/netlink/ip-addr-add.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env eco

local addr = require 'eco.ip'.address

local ifname = 'eth0'

local ok, err = addr.add(ifname, { address = '192.168.1.2', prefix = 32, scope = 'global' })
if not ok then
print('add fail:', err)
return
end
11 changes: 11 additions & 0 deletions examples/netlink/ip-addr-del.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env eco

local addr = require 'eco.ip'.address

local ifname = 'eth0'

local ok, err = addr.del(ifname, { address = '192.168.1.2', prefix = 32 })
if not ok then
print('del fail:', err)
return
end
15 changes: 15 additions & 0 deletions examples/netlink/ip-addr-get.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env eco

local addr = require 'eco.ip'.address

local ifname = 'eth0'

local res, err = addr.get(ifname)
if not res then
print('get fail:', err)
return
end

for k, v in pairs(res) do
print(k .. ':', v)
end
27 changes: 0 additions & 27 deletions examples/netlink/ip-addr.lua

This file was deleted.

0 comments on commit 61a9fd5

Please sign in to comment.