Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper guideline & example usage of the package #171

Open
VamshiKrishnaM13 opened this issue Nov 11, 2024 · 1 comment
Open

Proper guideline & example usage of the package #171

VamshiKrishnaM13 opened this issue Nov 11, 2024 · 1 comment

Comments

@VamshiKrishnaM13
Copy link

can anyone please give a simple example usage of creating namespaces, prefixes and then acquiring & releasing ip address with storage as postgres?

@majst01
Copy link
Contributor

majst01 commented Nov 11, 2024

If you plan to use the library, there is a example in the Readme with the in memory storage, if you want to use Postgres you must provide a postgres Storage to the ipamer like so:

    pgStorage, err := goipam.NewPostgresStorage("hostname", "port", "user", "password", "dbnam", goipam.SSLModePrefer)
    // Handle Error

    // Create a ipamer with in postgres storage
    ipam := goipam.New(bgCtx, pgStorage)

All other code remains the same as shown in the Readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants