Skip to content

denis-kilchichakov/usernames

Repository files navigation

usernames

Coverage Status Tests+Sanity

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 (Leetcode limited its GraphQL for external callers, no workaround yet)
  • 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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages