Skip to content

YasnaTeam/callbacker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Callbacker 📲

Callbacker is a utility for creating fake 🙉 callback URLs. Suppose you are working on a service which needs some callback calls from other services (like github or google). Then the main problem is getting callbacks on the localhost without any valid IP or URL ⛔. Callbacker is answer to that problem 👌.

Installing 💻

Direct method ⏬

Get executable package from latest release page and make it executable on your system.

Via GO! 🥇

Run this command

go get https://github.com/YasnaTeam/callbacker

Terminology ⤵️

Callbacker contains two part: server and client. server is one which register user connections, get their requests for callback definition and finally forward callback requests to client. client is the end user tools which can register callback, get forwarded request and send them to final destination.

Running a server instance 👷

Suppose your final domain is http://domain.ltd, first you must define an endpoint with /callback URI. On Nginx you can do that with some configurations like this:

server {
	server_name domain.ltd;

	location /callback {
		proxy_pass http://127.0.0.1:1616;
	}
}

then run the server:

./callbacker -v -s -u http://domain.ltd/callback

Defining a systemd service for server instance

For definition of a systemd service, you can create a file on ~/.config/systemd/user and put this lines on it:

[Unit]
Description=Callbacker
After=network.target

[Service]
Type=simple
NonBlocking=true

ExecStart=/absolute/path/to/callbacker -s -u http://domain.ltd/callback
Restart=on-failure
RestartSec=5s

then reload daemons with systemctl daemon-reload and run the service with systemctl start callbacker.

With ./callbacker -h you can see all available flags.

Running a client instance 🏣

In your local command line, just run this:

./callbacker -c domain.ltd:2424

on first run of callbacker you must choose your username:

$ ./callbacker -c domain.ltd:2424
Enter your username: 

with submitting username, you can view all options be pressing h:

$ ./callbacker -c domain.ltd:2424
Enter your username: meysampg
Please select a command (Press h for help): h
Use this commands:
    a (or add)	Add a route
    l (or list)	Print route table
    t (or truncate)	Truncate route table and configuration file
    x (or exit)	Exit from program

by pressing a you can add a local route to callbacker. Local route is an endpoint on your software which wanna receive information (for example from a github webhook or after logging in on google):

$ ./callbacker -c domain.ltd:2424
Please select a command (Press h for help): a

In this section you can add a local callback url. After adding the route, you
will recieve a unique callback url which you can use it as a valid callback.
Enter route: http://mysite.mpg/api/v1/my_endpoint

Now by pressing l you can view route and assigned callback to it:

Please select a command (Press h for help): l

 #	Route					Callback
 --	-----					--------
 1	http://mysite.mpg/api/v1/my_endpoint 	http://domain.ltd/callback/b5b1c30a-57e2-428e-861e-813d9a92fc0f

Now you can use http://domain.ltd/callback/b5b1c30a-57e2-428e-861e-813d9a92fc0f as a valid URL and pass it to origin ( e.g. github webhook, ...). Each time a callback has been called to this URL, all information of request will be sent to your running client and a callback will be simulated.

Contribution 💌

Fork from this project 🍴, do your modification and send a pull request!


Made with love in YasnaTeam ❤️