gomegle

package module
v0.0.0-...-773a915 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2016 License: GPL-3.0 Imports: 10 Imported by: 1

README

Gomegle

A library written in Go for interacting with Omegle (omegle.com) chat

Purpose

Create an easy to use library that fully implements the whole Omegle chat protocol. Also, it must include an example client for basic interaction

Feature matrix

Implemented Error checking
/stoplookingforcommonlikes yes yes
/generate yes yes
/send yes yes
/status yes yes
/typing yes yes
/stoppedtyping yes yes
/disconnect yes yes
/events yes yes
/start yes yes
/recaptcha yes yes

Credits

Part of this library is based on this awesome document

Documentation

Overview

Package gomegle lets you interface with Omegle in Go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event int

Event is a type used for storing the above event codes

const (
	WAITING          Event = iota // Waiting we get connected to a stranger/spyee or other session
	CONNECTED                     // We were connected to a session
	DISCONNECTED                  // We were disconnected from a session
	TYPING                        // Stranger is typing
	MESSAGE                       // Got a message from a stranger
	ERROR                         // Some kind of error occured
	STOPPEDTYPING                 // Stranger stopped typing
	IDENTDIGESTS                  // Identification of the session
	CONNECTIONDIED                // The connection has died unfortunately due to some reason :(
	ANTINUDEBANNED                // You were banned due to "bad behaviour" in the chat
	QUESTION                      // Question in a spyee/spyer session
	SPYTYPING                     // Spyee 1 or 2 is typing
	SPYSTOPPEDTYPING              // Spyee 1 or 2 has stopped typing
	SPYDISCONNECTED               // Spyee 1 or 2 has disconnected
	SPYMESSAGE                    // Spyee 1 or 2 has sent a message
	SERVERMESSAGE                 // Some kind of server message
	COUNT                         // Updated connection/online count
	COMMONLIKES                   // Shared topics between you and the stranger
	// If you get this you have to prove you're human by going to
	// google.com/recaptcha/api/image?c=[challenge] and sending the answer with
	// Recaptcha()
	RECAPTCHAREQUIRED
	RECAPTCHAREJECTED
	// Only in college mode, the stranger's college
	PARTNERCOLLEGE
)

Types of events UpdateEvents() will return

type LogEntry

type LogEntry struct {
	Tp         Tp
	Arg1, Arg2 string
}

LogEntry stores information needed for one entry

type Omegle

type Omegle struct {
	Lang   string // Optional, two character language code
	Group  string // Optional, "unmon" to join unmonitored chat
	Server string // Optional, can specify a certain server to use

	Question        string   // Optional, if not empty used as the question in "spyer" mode
	Cansavequestion bool     // Optional, if question is not "" then permit omegle to save the question
	Wantsspy        bool     // Optional, if true then "spyee" mode is started
	Topics          []string // Optional, if not empty will look only for people interested in these topics

	College     string // Optional, if not empty must exactly match the college identifier as on omegle.com (such as "ktu.edu")
	CollegeAuth string // Optional, if not empty then used as identifier of your college. You need to get this from omegle.com
	AnyCollege  bool   // Optional, if in college mode then it will connect you to any college
	// contains filtered or unexported fields
}

Omegle stores information about the connection to omegle.com

func (*Omegle) Disconnect

func (o *Omegle) Disconnect() (err error)

Disconnect from the Omegle server

func (*Omegle) Generate

func (o *Omegle) Generate(identdigests string, logs []LogEntry) (url string, err error)

Generate sends a request to generate a log file to omegle and returns the image link.

func (*Omegle) GetID

func (o *Omegle) GetID() (err error)

GetID gets and sets a new id

func (*Omegle) GetStatus

func (o *Omegle) GetStatus() (st Status, err error)

GetStatus gets status of omegle via http://[server].omegle.com/status

func (*Omegle) Recaptcha

func (o *Omegle) Recaptcha(challenge, response string) error

Recaptcha sends back the response to given challenge to omegle Only to be used in case of recaptchaRequired or recaptchaRejected events

func (*Omegle) SendMessage

func (o *Omegle) SendMessage(msg string) (err error)

SendMessage sends a message to the stranger

func (*Omegle) ShowTyping

func (o *Omegle) ShowTyping() (err error)

ShowTyping shows to the stranger that we are typing

func (*Omegle) StopLookingForCommonLikes

func (o *Omegle) StopLookingForCommonLikes() error

StopLookingForCommonLikes stops looking for strangers only interested in specified topics

func (*Omegle) StopTyping

func (o *Omegle) StopTyping() (err error)

StopTyping shows to the stranger that we stopped typing

func (*Omegle) UpdateEvents

func (o *Omegle) UpdateEvents() (st []interface{}, msg [][]string, err error)

UpdateEvents visits the events page and gathers new events

type Status

type Status struct {
	Count           int  // Connection count
	ForceUnmon      bool // If true then your IP was banned
	Antinudeservers []string
	Antinudepercent float64
	// If spyQueueTime is larger, there are more spies than spyees which the client
	// can use to suggest a mode
	SpyQueueTime   float64
	SpyeeQueueTime float64
	Timestamp      float64
	Servers        []string
}

Status stores information about omegle status

type Tp

type Tp int

Saves the following constants used in LogEntry

const (
	DEF    Tp = iota // smaller, bold font, gray (Arg1)
	Q                // blue question box (Arg1)
	STR              // large font, first item is red (Arg1)
	STR1             // as above (Arg1)
	STR2             // large font, first item is blue (Arg1)
	YOU              // as above (Arg1)
	NORMAL           // normal font, first item is bold (Arg1, Arg2)
)

Available log entry types for Generate(). The parantheses next to the constants show which arguments are used, if any.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL