Contains a function to get an ip that can be used like localhost.

Get the host IP

Contains a function to get an ip that can be used like localhost.

Motivation

If you have a rest api running in a machine executor on CircleCI and try to make a http request to localhost, it won't work.

You can use this package to get an ip that you can call just like localhost.

Install

go get github.com/poorlydefinedbehaviour/go-machineip

Example

This example assumes there is a server running on port 5000.

import (
  "testing"
  "http"
  "github.com/poorlydefinedbehaviour/go-machineip"
)

func Test_MyTest(t *testing.T) {
	t.Parallel()

	endpoint := fmt.Sprintf("%s:5000", machineip.IP())

	response, err := http.Get(endpoint)
	// ...
}
Similar Resources

This contains some example (micro)service

This contains some example (micro)service. It should expose some of the issues when tyring to put too much logic into one file or to mix things that should not be mixed together.

Jan 11, 2022

Orders - An example of gin contains many useful features

Orders - An example of gin contains many useful features

Go Gin Example An example of gin contains many useful features 简体中文 Installation

Feb 22, 2022

Golang function throttler

go-throttle Golang function throttler. Similar to debounce, but the first call will execute immediately. Subsequent calls will always have a minimum d

Jul 18, 2022

Squizit is a simple tool, that aim to help you get the grade you want, not the one you have learnt for.

Squizit is a simple tool, that aim to help you get the grade you want, not the one you have learnt for.

Squizit is a simple tool, that aim to help you get the grade you want, not the one you have learnt for. Screenshots First, input PIN Then enjoy! Hoste

Mar 11, 2022

Analyze the binary outputted by `go build` to get type information etc.

Analyze the binary outputted by go build to get type information etc.

Oct 5, 2022

set and get github user statuses

gh user-status being an extension for interacting with the status on a GitHub profile. gh user-status set gh user-status set interactively set status

Nov 19, 2022

Don't get surprised by your environment variables.

checkenv Don't get surprised by your environment variables. Rationale At Bugout, we configure our applications using environment variables. This follo

Dec 20, 2021

create a provider to get atlassian resources

Terraform Provider Scaffolding This repository is a template for a Terraform provider. It is intended as a starting point for creating Terraform provi

Dec 31, 2021

Get and save EroCool.com images

Get and save EroCool.com images

Nov 9, 2021
URLHEALTH - a utility function to help ensure that broken urls on documentations can be detected

UrlHealth URLHEALTH is a utility function to help ensure that broken urls on documentations can be detected. We have all followed that greate tutorial

Jan 14, 2022
Search running process for a given dll/function. Exposes a bufio.Scanner-like interface for walking a process' PEB

Search running process for a given dll/function. Exposes a bufio.Scanner-like interface for walking a process' PEB

Apr 21, 2022
GoDumpLsass is a simple tool that can dump lsass without to get caught by Windows Defender.

GoDumpLsass GoDumpLsass is a simple tool that can dump lsass without to get caught by Windows Defender. Releases https://github.com/Enelg52/GoDumpLsas

Nov 4, 2022
Get user-like access to VirtualBox VMs from Go code.

#Vboxgo Get user-like access to VirtualBox VMs from Go code. This library wraps some define-tainted VirtualBox SDK functions, making it possible to ge

Oct 25, 2021
A project that provides an in-memory key-value store as a REST API. Also, it's containerized and can be used as a microservice.

Easy to Use In-Memory Key-Value Store A project that provides an in-memory key-value store as a REST API. Also, it's containerized and can be used as

Mar 6, 2022
Packer Plugin Vagrant - The Vagrant multi-component plugin can be used with HashiCorp Packer to create custom images

Packer Plugin Vagrant - The Vagrant multi-component plugin can be used with HashiCorp Packer to create custom images

Jul 13, 2022
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Advent of Code 2021 Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved

Dec 2, 2021
Jan 4, 2022
Generate random, pronounceable, sometimes even memorable, "superhero like" codenames - just like Docker does with container names.

Codename an RFC1178 implementation to generate pronounceable, sometimes even memorable, "superheroe like" codenames, consisting of a random combinatio

Dec 11, 2022
Beecrowd is a Jugde Online Plataform to problems submissions. This repo contains all my submissions to Beecrowd.

Beecrowd Solutions Keywords: Beecrowd, judge, problems, competitive, programming, solutions, ad-hoc, sql, strings, algorithms, math, graphs Table of C

Jan 5, 2022