godevicedetect

package module
v0.0.0-...-8314e09 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2015 License: MIT Imports: 9 Imported by: 1

README

Device Detect Package for Go

Provides the ability to detect different devices by it's user agent.

Status: not stable yet!

Installation

$ go get github.com/Shaked/godevicedetect

Usage

Examples

Contribute

If you wish to contribute, please just make sure that if its user agent related, you should add it to the user agent repository.

Open Discussion

Unknown user agents can be saved for later usage. This can be solved by:

  1. Resolve by regex inside the Handle.Unknown method
  2. Save the result into an extra file\resource
  3. Result should point to the right device or be marked as Unknown without re using the regex.

Documentation

Index

Constants

View Source
const (
	UnknownOs      = "UnknownOs"
	UnknownVersion = "UnknownVersion"
)

Variables

This section is empty.

Functions

func HandlerMux

func HandlerMux(s *http.ServeMux, p *PreCompiledHandler) http.Handler

func Platform

func Platform(r *http.Request) platform.Device

Vars returns the route variables for the current request, if any.

func UserAgentToKey

func UserAgentToKey(userAgent string) uint32

Types

type Compiled

type Compiled struct {
	// contains filtered or unexported fields
}

type DeviceDetect

type DeviceDetect struct {
	// contains filtered or unexported fields
}

func NewDeviceDetect

func NewDeviceDetect(r *http.Request, p *PreCompiledHandler) *DeviceDetect

func (*DeviceDetect) FindByUserAgent

func (d *DeviceDetect) FindByUserAgent(userAgent string) platform.Device

func (*DeviceDetect) PlatformType

func (d *DeviceDetect) PlatformType() platform.Device

type PreCompiledHandler

type PreCompiledHandler struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL