/gomobiledetect

Go Mobile Detect is a lightweight Go package imported from PHP for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment

Primary LanguageGoMIT LicenseMIT

GoMobileDetect

GoDoc Build Status Coverage Status

Description

GoMobileDetect is a lightweight package imported from PHP for detecting mobile devices including tablets.

The package is imported from MobileDetect which was originally written in PHP.

Installation

$ go get github.com/Shaked/gomobiledetect 

Updates

Version 1.2.0

  • Now supports using Http.Handler implementation. See examples

Version 1.0.0

  • The package name had been changed to mobiledetect.

Version 0.2.0

  • This version introduces a new method IsKey(key int). This method is faster than the Is(key string). All keys can be found here

  • The Is(key string) has been changed to support both string and int using the interface{}.

Benchmarking

Version 0.1.2
BenchmarkIsMobile       2000       1001884 ns/op
ok      github.com/Shaked/gomobiledetect    7.091s
Version 0.2.0
BenchmarkIsMobile     100000         19278 ns/op
ok      github.com/Shaked/gomobiledetect    7.448s

Usage

There are different ways of using the package:

License

Go Mobile Detect is an open-source script released under MIT License.