diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-11-08 23:02:43 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-11-08 23:02:43 +0900 |
commit | 4e061146fda35d2686766b3562dbfedc1de6ad5e (patch) | |
tree | 5d115913bf5259183a01cdedf0dbddd97920c3a4 /tools/config | |
parent | 0310feb4a801ee849f450df68e72ea1bd7b3bd52 (diff) |
tools: add generator for example config file
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'tools/config')
-rw-r--r-- | tools/config/example_toml.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tools/config/example_toml.go b/tools/config/example_toml.go new file mode 100644 index 00000000..0fb9b93b --- /dev/null +++ b/tools/config/example_toml.go @@ -0,0 +1,44 @@ +package main + +import ( + "../../config" + "bytes" + "fmt" + "github.com/BurntSushi/toml" + "net" +) + +func main() { + b := config.BgpType{ + Global: config.GlobalType{ + As: 12332, + RouterId: net.ParseIP("10.0.0.1"), + }, + NeighborList: []config.NeighborType{ + config.NeighborType{ + PeerAs: 12333, + NeighborAddress: net.ParseIP("192.168.177.32"), + AuthPassword: "apple", + }, + config.NeighborType{ + PeerAs: 12334, + NeighborAddress: net.ParseIP("192.168.177.33"), + AuthPassword: "orange", + }, + config.NeighborType{ + PeerAs: 12335, + NeighborAddress: net.ParseIP("192.168.177.34"), + AuthPassword: "grape", + }, + }, + } + + var buffer bytes.Buffer + encoder := toml.NewEncoder(&buffer) + err := encoder.Encode(b) + if err != nil { + panic(err) + } + + fmt.Printf("%v\n", buffer.String()) +} |