Giter VIP home page Giter VIP logo

popgun's Introduction

POPgun

Build Status Coverage Status Go Report Card

POPgun is a lightweight POP3 server implementation in Go. POPgun meets RFC1939 and was mainly created for develmail.com.

Getting Started

POPgun is meant to be used as a package and you need to create your own implementations of Authorizator and Backend interfaces.

1. Import the POPgun package

import (
    "github.com/DevelHell/popgun"
)

2. Implement Authorizator and Backend interfaces

Authorizator is used for user authorization and there's only one function Authorize(user, pass string). Be aware that single instance is shared across all client connections.

Backend is used for mail storage access, e.g. database storage. Single Backend instance is shared across all client connections connections as well.

Example dummy implementations can be found in backend package, see comments in these files for more information. When your're done, create an instance of both of them:

backend := backends.DummyBackend{}
authorizator := backends.DummyAuthorizator{}

3. Configure and run the server

There is only one configuration field for now - ListenInterface, which defines interface (ip address) and port to listen on. Server is started in separate go routine, so be sure to keep the server busy, e.g. using wait groups:

cfg := popgun.Config{
    ListenInterface: "localhost:1100",
}

var wg sync.WaitGroup
wg.Add(1)

server := NewServer(cfg, authorizator, backend)
err := server.Start()
if err != nil {
    log.Fatal(err)
    return
}
wg.Wait()

Server is logging to stderr using log package.

License and Contribution

POPgun is released under MIT license. Feel free to fork, redistribute or contribute!

popgun's People

Contributors

dusankasan avatar peterkrejci avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.