atermsearch

package module
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 8 Imported by: 1

README

koron-go/atermsearch

PkgGoDev Actions/Go Go Report Card

Package to search for Aterm devices. It is reimplementation of Aterm search tool in Go.

Getting Started

$ go get github.com/koron-go/atermsearch@latest

Example

package main

import (
    "context"
    "fmt"

    "github.com/koron-go/atermsearch"
)

func main() {
    ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
    defer cancel()
    dev, err := atermsearch.Search(ctx, "192.168.0.123")
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Aterm device: %+v\n", dev)
}

Documentation

Overview

Package atermsearch provides functions to search for Aterm devices.

Index

Constants

This section is empty.

Variables

View Source
var (
	ModeBridge              = Mode{0, "Bridge", "ブリッジ"}
	ModePPPoERouter         = Mode{1, "PPPoE Router", "PPPoEルーター"}
	ModeLocalRouter         = Mode{2, "Local Router", "ローカルルーター"}
	ModeWirelessLANAdapter  = Mode{3, "Wireless LAN Adapter", "無線LAN子機"}
	ModeWirelessLANRepeater = Mode{4, "Wireless LAN Repeater", "無線LAN中継器"}
	ModeMapE                = Mode{5, "MAP-E", "MAP-E"}
	Mode464XLAT             = Mode{6, "464XLAT", "464XLAT"}
	ModeDSLite              = Mode{7, "DS-Lite", "DS-Lite"}
	ModeFixedIPs            = Mode{8, "Fixed IP 1", "固定IP1"}
	ModeMultipleFixedIPs    = Mode{9, "Multiple Fixed IPs", "複数固定IP"}
	ModeMeshRepeater        = Mode{10, "Mesh Repeater", "メッシュ中継器"}
)

Functions

func ProductName

func ProductName(ctx context.Context, addr string) (string, error)

ProductName tries to get the product name of addr as an Aterm device.

Types

type Device

type Device struct {
	Address     string
	ProductName string
	SystemMode  Mode
}
func Search(ctx context.Context, addr string) (*Device, error)

Search tries to get the device information of addr as an Aterm device.

type Mode

type Mode struct {
	ID   int
	Name string

	NameJA string
}

func SystemMode

func SystemMode(ctx context.Context, addr string) (Mode, error)

SystemMode tries to get the system mode of addr as an Aterm device.

Jump to

Keyboard shortcuts

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