GithubHelp home page GithubHelp logo

resolvconf's People

Contributors

fa1k3n avatar

Stargazers

 avatar

Watchers

 avatar

resolvconf's Issues

Remove should have same variadic interface as Add

it is possible to do

resolvconf.Add(ns1, ns2, opt1 et.c.)

to add items, but to remove them you need to call

resolvconf.Remove(ns1)
resolvconf.Remove(ns2)
resolvconf.Remove(opt1)

it should be possible to remove using

resolvconf.Remove(ns1, ns2, opt1)

NewOption should not be variadic but chainable

Instead of NewOption(type string, ...interface{}) it should be NewOption(type string) and a method Set(val int) that sets value, Get that returns, then you can do

NewOption(“ndots”).Set(4)

and

conf.Find(NewOption(“ndots”)).Get()

Create and add item at the same time

When creating an item today you get the items and an possible error back, then you can use the item to add to the conf

opt, err := resolvconf.NewOption("debug")
err = conf.Add(opt)

this prevents us from adding options at the same time as they are created and sortof uglifies the interface. I would prefer to be able to do

err := conf.Add(resolvconf.NewOption("debug"))

Remove New from item constructors

instead of

ns := resolvconf.NewNameserver(net.ParseIP("8.8.8.8'"))

it should be

ns := resolvconf.Nameserver(net.ParseIP("8.8.8.8'"))

this is valid for all Items e.g NewOption == Option

Debug printouts

It should be possible to have the library log all updates it does, e.g. removing nameservers, adding options et.c.

Find interface is pretty ugly

when using you need to do several derefs

item := resolvconf.Find(resolvconf.NewOption("debug"))
opt := (*item).(*resolvconf.Option)

would be cleaner to have

item := resolvconf.Find(resolvconf.NewOption("debug"))
opt := item.(resolvconf.Option)

i.e. have Find return ConfItem instead of *ConfItem

Adding multiple items does not play nice with errors

When adding multiple items and there is an error in one of the items then none of the items following the faulty item will be added.
This code

err := conf.Add(ns1, ns2, <faulty item>, opt1)

will only add ns1 and ns2 to the conf

I would prefer to have the error accumulate and returned after all items have been handeld, so that ns1 & 2 and opt1 are added above. Then the error returned must be the accumulated error from all the faulty items

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.