瀏覽代碼

[plugins/file] Added documentation

Signed-off-by: Andrea Barberio <insomniac@slackware.it>
Andrea Barberio 6 年之前
父節點
當前提交
a8ccf129b5
共有 2 個文件被更改,包括 23 次插入1 次删除
  1. 0 0
      cmds/coredhcp/file_leases.txt.example
  2. 23 1
      plugins/file/plugin.go

+ 0 - 0
cmds/coredhcp/leases.txt.example → cmds/coredhcp/file_leases.txt.example


+ 23 - 1
plugins/file/plugin.go

@@ -1,4 +1,26 @@
-package clientport
+package file
+
+/*
+The `file` plugin enables static mapping of MAC <--> IP addresses.
+The mapping is stored in a text file, where each mapping is described by one line containing
+two fields separated by spaces: MAC address, and IP address. For example:
+
+$ cat file_leases.txt
+00:11:22:33:44:55 10.0.0.1
+01:23:45:67:89:01 10.0.10.10
+
+To specify the plugin configuration in the server6/server4 sections of the config file, just
+pass the leases file name as plugin argument, e.g.:
+
+$ cat config.yml
+server6:
+    ...
+    plugins:
+      - file: "file_leases.txt"
+    ...
+
+If the file path is not absolute, it is relative to the cwd where coredhcp is run.
+*/
 
 import (
 	"bytes"