Code Monkey home page Code Monkey logo

Comments (3)

huin avatar huin commented on June 12, 2024

Hm, that's fiddly. But not the first time that a device doesn't match the standard in this place.

There's an existing "hack" here:
https://github.com/huin/goupnp/blob/master/cmd/goupnpdcpgen/metadata.go#L57

The UPNP standard states "ui4" (aka uint32 in Go), which this hack promotes to "ui8" (uint64 as you've probably seen). This was contributed by someone else using this library who ran into a device that exceeded a value of 2^31-1.

Two options spring to mind:

  1. We could try changing this hack from "ui8" to "int" (yeah, gotta love the consistency: https://github.com/huin/goupnp/blob/master/cmd/goupnpdcpgen/typemap.go#L18). The thing that bothers me is that it could cause incompatibilities with other people using this library -- i.e their existing code reads this value into a variable/field of type uint64, which would now no longer compile.

  2. Another alternative might be to try and introduce another hack that creates another method that has a different name, calls the same SOAP method, but returns int64 instead. A bit more complex and ugly, but keeps compatibility.

Thoughts?

from goupnp.

karnauskas avatar karnauskas commented on June 12, 2024

I would suggest to follow standards and make less hacks. AFAIK it works without any problem with miniupnpd, tho not with some weird implementations. Even, if goupnp could parse that value, it's going like sinusoid - difficult to track existing state. I would rather allow to let weird implementation router to deprecate.

from goupnp.

huin avatar huin commented on June 12, 2024

Just revisiting this years later. A workaround in specific cases where this happens could be to fork a copy of the implementation of the existing function, and use that instead of changing this package.

from goupnp.

Related Issues (20)

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.