usernames

package module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 2 Imported by: 0

README

usernames

Coverage Status

Library that checks if given username exists on popular internet services.

Installation

go get github.com/denis-kilchichakov/usernames@v0.7.0

Usage

Simple example:

package main

import (
	"fmt"

	"github.com/denis-kilchichakov/usernames"
)

func main() {
	u := "username-to-check"
	parallelism := 2
	checkResults := usernames.CheckAll(u, parallelism)
	fmt.Printf("Check results for username \"%s\":\n", u)
	for _, r := range checkResults {
		if r.Err != nil {
			fmt.Printf("Error on %s: %v\n", r.Service, r.Err)
			continue
		}
		fmt.Printf("%s: %v\n", r.Service, r.Found)
	}
}

Output:

Check results for username "username-to-check":
gitlab: false
leetcode: false
instagram: false
stackoverflow: false
reddit: false
dockerhub: false
github: false

Tests

To launch sanity checks (which do requests to actual services instead of mocks in unit tests):

go test ./... -tags=sanity

Working in VS Code

For sanity test files to be processed correctly by VS Code, consider adding this to settings.json:

    "gopls.buildFlags": ["-tags=sanity"],

Supported services:

  • GitHub
  • GitLab
  • LeetCode
  • Instagram
  • StackOverflow
  • DockerHub
  • Reddit

How to add more services

Inside package services:

  1. Create subpackage for your service
  2. Implement contract.ServiceChecker interface
  3. Add registerService() call in init() (services package)

Services planned to be added in future:

  • CodeWars
  • HackerRank
  • Habr
  • Kaggle
  • Telegram
  • X (Twitter)
  • LinkedIn
  • Facebook
  • Google
  • TikTok
  • Pinterest
  • ...
  • you name it

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServicesByTag

func ServicesByTag(tag string) []string

func SupportedServices

func SupportedServices() []string

func SupportedTags

func SupportedTags() []string

Types

type CheckResult

type CheckResult struct {
	Service string
	Err     error
	Found   bool
}

func Check

func Check(services []string, username string, parallelism int) []CheckResult

func CheckAll

func CheckAll(username string, parallelism int) []CheckResult

func CheckByTags

func CheckByTags(tags []string, username string, parallelism int) []CheckResult

func CheckExcluding

func CheckExcluding(services []string, username string, parallelism int) []CheckResult

Jump to

Keyboard shortcuts

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