beito123/go-raknet

Rename event functions in Handler

beito123 opened this issue · 4 comments

Reason

Current names are very confusing!

// event function
func AddedBlockedAddress(){}

// normal function
func AddBlockedAddress(){}

For now, I think that they should change to OnEventName.
func AddedBlockedAddress()-> func OnAddedBlockedAddress()

Help wanted

But I want to change Go-like codes.

If you know better idea, please tell me.

You should organize it even more by defining types to these functions.

Like how?

for example instead of func MakeServerGay(), you'd do func (s *Server) MakeGay().

Sorry, I didn't explain enough.

For now, Handler is a interface whose looks like a event listener.
but, I'm not sure if it's correct for implementation like Go.

I think that codes like OnABCEvent() aren't used nearly.

but StartServer() and AddedBlockedAddress() and more are very confusing.

For example, if run StartServer(), start a server.
And if run AddedBlockedAddress(), add a blocked address.

In a word, I want Handler to be go-like.