Git Product home page Git Product logo

smcroute's Introduction

Smcroute

GoDoc Coverage Status Go Report Card

Smcroute is client library for smcroute written in Go programming language.

Library uses unix domain socket for communication.

Tested with [email protected] and [email protected].

Quick-start

$ sudo chmod 777 /var/run/smcroute
package main

import (
  "fmt"

  "github.com/go-x-pkg/smcroute"
)

// sudo smcroute -j eth0.1 239.255.1.1
func main() {
  client := smcroute.NewClient()
  cmdJoin := smcroute.NewCmd(smcroute.CmdJoin, "eth0.1", "239.255.1.1")
  resp, err := client.Exec(cmdJoin)
  fmt.Println(resp, err)
}

Join and leave

$ sudo chmod 777 /var/run/smcroute
$ ip maddr show eth0.1
2:      eth0.1
        link  33:33:00:00:00:01
        link  01:00:5e:00:00:01
        link  33:33:ff:93:e9:07
        link  33:33:00:00:02:02
        inet  224.0.0.1
        inet6 ff02::202
        inet6 ff02::1:ff93:e907
        inet6 ff02::1
        inet6 ff01::1
package main

import (
  "fmt"

  "github.com/go-x-pkg/smcroute"
)

// sudo smcroute -j eth0.1 239.255.1.1
func main() {
  client := smcroute.NewClient()
  cmdJoin := smcroute.NewCmd(smcroute.CmdJoin, "eth0.1", "239.255.1.1")
  resp, err := client.Exec(cmdJoin)
  fmt.Println(resp, err)
}
$ ip maddr show eth0.1
2:      eth0.1
        link  33:33:00:00:00:01
        link  01:00:5e:00:00:01
        link  33:33:ff:93:e9:07
        link  33:33:00:00:02:02
        inet  224.0.0.1
        inet  239.255.1.1        # <--- +1
        inet6 ff02::202
        inet6 ff02::1:ff93:e907
        inet6 ff02::1
        inet6 ff01::1
package main

import (
  "fmt"

  "github.com/go-x-pkg/smcroute"
)

// sudo smcroute -l eth0.1 239.255.1.1
func main() {
  client := smcroute.NewClient()
  cmdLeave := smcroute.NewCmd(smcroute.CmdLeave, "eth0.1", "239.255.1.1")
  resp, e := client.Exec(cmdLeave)
  fmt.Println(resp, e)
}
$ ip maddr show eth0.1
2:      eth0.1
        link  33:33:00:00:00:01
        link  01:00:5e:00:00:01
        link  33:33:ff:93:e9:07
        link  33:33:00:00:02:02
        inet  224.0.0.1
        inet6 ff02::202
        inet6 ff02::1:ff93:e907
        inet6 ff02::1
        inet6 ff01::1

smcroute's People

Contributors

deepsourcebot avatar vany-egorov avatar

Watchers

 avatar

smcroute's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.