Goamf
This is a adobe amf library for golang, only amf3 supported for now.
Install / Use
/learn @lazytiger/GoamfREADME
First of all, please forgive my poor english.
This is an adobe amf library for golang. As you know amf has defined many types that go does not support, for those types, this library just ignored. This library has implmented amf3.
Endode: Encode means to map go types to amf types, there is serveral rules you should know
- go string will be encode to amf string, the length should be no longer thant a u29
- go int8, int16 will be encode as amf integer, e.g u29
- go int64, int32, int, if it lies in [-0xfffffff, 0x20000000), it will be encoded as u29, if it lies in [-0x7fffffff, -0xfffffff], it will be encoded as double, otherwise, it will be encoded as string
- go uint8, uint16 will be encode as amf integer
- go uint64, uint32, uint, if it lies in [0, 0x2000000), it will be encoded as u29, if it lies in [0x20000000, 0x7fffffff], it will be encoded as double, otherwise, it will be encoded as string
- go float32, float64 will be encoded as double
- go array, slice will be encoded as amf array, emca array does not supported
- go map, struct will be encoded as amf object, only amf dynamic object supported
- other types not listed above will not supported
NOTICE: Because struct is passed by value, so just for effient, you should pass the top level struct as pointer, or it will return an error. Struct field name will be encoded as object key follows such rules:
- if field has tag "amf.name", the tag will be used.
- encoder configed as reserved, the field name will be used.
- encoder configed as not reserved, the first rune of field name will be transfered to lower
- if field can't be accssed, ignore
Usage:
encoder := amf.NewEncoder(writer, true) err := encoder.Encode(xxx) if err != nil { xxx }
Decode: Decode means to map amf types to go types, the rule is the same as encoding. As you can see, many go types may map to only one amf type, so decoder support to specify a concrete value
Usage:
decoder := amf.NewDecoder(reader) ret := new(xxx) err := decoder.Decode(ret) if err != nil { xxx }
For more information, you could just see the test as example.
Related Skills
openhue
349.2kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
349.2kElevenLabs text-to-speech with mac-style say UX.
weather
349.2kGet current weather and forecasts via wttr.in or Open-Meteo
tradingview-mcp
682Advanced TradingView MCP Server for AI-powered market analysis. Real-time crypto & stock screening, technical indicators, Bollinger Band intelligence, and candlestick patterns. Works with Claude Desktop & AI assistants. Multi-exchange support (Binance, KuCoin, Bybit+). Open source trading toolkit.
